Skip to content

Upgrade to 31.0.14 breaks SFTP external storage and takes files app with it #58324

@jonas2515

Description

@jonas2515

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"}

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap31-feedbackbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions