Skip to content

[Bug]: external storage support default port for sftp broken #58507

@Thernamyte

Description

@Thernamyte

⚠️ This issue respects the following points: ⚠️

Bug description

after update to 32.0.6 external storage support throws this error:

TypeError: fsockopen(): Argument #2 ($port) must be of type int, string given in $WEBROOT/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php:1309

if port is supplied manually (22) this is resolved

Steps to reproduce

  1. activate external storage support
  2. add (valid) sftp
  3. don't fill port (assume default 22)

Expected behavior

my files to show

Nextcloud Server version

32

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.4

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated from a MINOR version (ex. 32.0.1 to 32.0.2)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.thern.wtf"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "32.0.6.1",
        "overwrite.cli.url": "https:\/\/cloud.thern.wtf",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "updater.secret": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "loglevel": 2
    }
}

List of activated Apps

Enabled:
  - activity: 5.0.0
  - app_api: 32.0.0
  - bruteforcesettings: 5.0.0
  - calendar: 6.2.0
  - circles: 32.0.0
  - cloud_federation_api: 1.16.0
  - comments: 1.22.0
  - contacts: 8.3.3
  - contactsinteraction: 1.13.1
  - dashboard: 7.12.0
  - dav: 1.34.2
  - federatedfilesharing: 1.22.0
  - federation: 1.22.0
  - files: 2.4.0
  - files_downloadlimit: 5.0.0-dev.0
  - files_external: 1.24.1
  - files_pdfviewer: 5.0.0
  - files_reminders: 1.5.0
  - files_sharing: 1.24.1
  - files_trashbin: 1.22.0
  - files_versions: 1.25.0
  - firstrunwizard: 5.0.0
  - logreader: 5.0.0
  - lookup_server_connector: 1.20.0
  - nextcloud_announcements: 4.0.0
  - notes: 4.13.0
  - notifications: 5.0.0
  - oauth2: 1.20.0
  - password_policy: 4.0.0
  - photos: 5.0.0
  - privacy: 4.0.0
  - profile: 1.1.0
  - provisioning_api: 1.22.0
  - recommendations: 5.0.0
  - related_resources: 3.0.0
  - richdocuments: 9.0.3
  - serverinfo: 4.0.0
  - settings: 1.15.1
  - sharebymail: 1.22.0
  - sociallogin: 6.3.1
  - support: 4.0.0
  - survey_client: 4.0.0
  - systemtags: 1.22.0
  - text: 6.0.1
  - theming: 2.7.0
  - twofactor_backupcodes: 1.21.0
  - updatenotification: 1.22.0
  - user_status: 1.12.0
  - viewer: 5.0.0
  - weather_status: 1.12.0
  - webhook_listeners: 1.3.0
  - workflowengine: 2.14.0
Disabled:
  - admin_audit: 1.22.0
  - encryption: 2.20.0
  - mail: 5.6.12
  - suspicious_login: 10.0.0
  - twofactor_nextcloud_notification: 6.0.0
  - twofactor_totp: 14.0.0
  - user_ldap: 1.23.0

Nextcloud Signing status

No errors have been found

Nextcloud Logs

{"reqId":"5g97Wm0Lb1vkHbcKmbMZ","level":3,"time":"2026-02-22T16:09:44+00:00","remoteAddr":"88.65.21.158","user":"imap-oidc-26b4093c9206048d9394ad32aee0eda5","app":"index","method":"PUT","url":"/index.php/apps/files_external/globalstorages/1","scriptName":"/index.php","message":"fsockopen(): Argument #2 ($port) must be of type int, string given in file '/home/phillipthern/web/cloud.thern.wtf/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php' line 1309","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0","version":"32.0.6.1","exception":{"Exception":"Exception","Message":"fsockopen(): Argument #2 ($port) must be of type int, string given in file '/home/phillipthern/web/cloud.thern.wtf/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php' line 1309","Code":0,"Trace":[{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/base.php","line":1091,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/index.php","line":25,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/private/AppFramework/Http/Dispatcher.php","Line":150,"Previous":{"Exception":"TypeError","Message":"fsockopen(): Argument #2 ($port) must be of type int, string given","Code":0,"Trace":[{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","line":1309,"function":"fsockopen"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","line":5217,"function":"_connect","class":"phpseclib\\Net\\SSH2","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/apps/files_external/lib/Lib/Storage/SFTP.php","line":117,"function":"getServerPublicHostKey","class":"phpseclib\\Net\\SSH2","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/apps/files_external/lib/Lib/Storage/SFTP.php","line":149,"function":"getConnection","class":"OCA\\Files_External\\Lib\\Storage\\SFTP","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/apps/files_external/lib/MountConfig.php","line":96,"function":"test","class":"OCA\\Files_External\\Lib\\Storage\\SFTP","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/apps/files_external/lib/Controller/StoragesController.php","line":225,"function":"getBackendStatus","class":"OCA\\Files_External\\MountConfig","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/apps/files_external/lib/Controller/GlobalStoragesController.php","line":182,"function":"updateStorageStatus","class":"OCA\\Files_External\\Controller\\StoragesController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/private/AppFramework/Http/Dispatcher.php","line":204,"function":"update","class":"OCA\\Files_External\\Controller\\GlobalStoragesController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/lib/base.php","line":1091,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/home/phillipthern/web/cloud.thern.wtf/public_html/index.php","line":25,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/phillipthern/web/cloud.thern.wtf/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","Line":1309},"message":"fsockopen(): Argument #2 ($port) must be of type int, string given in file '/home/phillipthern/web/cloud.thern.wtf/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php' line 1309","exception":{},"CustomMessage":"fsockopen(): Argument #2 ($port) must be of type int, string given in file '/home/phillipthern/web/cloud.thern.wtf/public_html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php' line 1309"}}

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions