-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
We updated to 31.0.14 yesterday and that broke SFTP external storage, likely because something about the way the sftp-port is stored changed.
This took down the entire files app with it, which would no longer show any files for users with external storage.
Had this error from phpseclib on the logs: fsockopen(): Argument #2 ($port) must be of type int, string given
We tracked it down to a missing type-cast to int in /apps/files_external/lib/Lib/Storage/SFTP.php, line 67: $this->port = $parameters['port'] ?? $parsedHost[1]; -> $this->port = (int) ($parameters['port'] ?? $parsedHost[1];)
This at least made the files in the file browser reappear, but external storage was still broken. Then entered port 22 into the settings for the sftp external storage server, and that fixed the external storage as well. When port 22 was entered, the type-case to int was no longer needed. I assume what broke with the update is that the default port no longer resolves to 22, but rather to an empty string now.
Full Error: {"Exception":"TypeError","Message":"fsockopen(): Argument #2 ($port) must be of type int, string given","Code":0,"Trace":[{"file":"/var/www/nextcloud/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","line":1358,"function":"fsockopen"},{"file":"/var/www/nextcloud/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","line":5364,"function":"_connect","class":"phpseclib\\\\Net\\\\SSH2","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php","line":108,"function":"getServerPublicHostKey","class":"phpseclib\\\\Net\\\\SSH2","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php","line":477,"function":"getConnection","class":"OCA\\\\Files_External\\\\Lib\\\\Storage\\\\SFTP","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":293,"function":"getMetaData","class":"OCA\\\\Files_External\\\\Lib\\\\Storage\\\\SFTP","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php","line":242,"function":"getMetaData","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":293,"function":"getMetaData","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Availability","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":293,"function":"getMetaData","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":98,"function":"getMetaData","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":139,"function":"getData","class":"OC\\\\Files\\\\Cache\\\\Scanner","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1558,"function":"scanFile","class":"OC\\\\Files\\\\Cache\\\\Scanner","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Node/Folder.php","line":81,"function":"getDirectoryContent","class":"OC\\\\Files\\\\View","type":"->"},{"file":"/var/www/nextcloud/apps/files/lib/Controller/ApiController.php","line":310,"function":"getDirectoryListing","class":"OC\\\\Files\\\\Node\\\\Folder","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":200,"function":"getFolderTree","class":"OCA\\\\Files\\\\Controller\\\\ApiController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\\\AppFramework\\\\Http\\\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\\\AppFramework\\\\Http\\\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\\\AppFramework\\\\App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":49,"function":"match","class":"OC\\\\Route\\\\Router","type":"->"},{"file":"/var/www/nextcloud/ocs/v2.php","line":7,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","Line":1358,"message":"fsockopen(): Argument #2 ($port) must be of type int, string given","exception":{},"CustomMessage":"fsockopen(): Argument #2 ($port) must be of type int, string given"}