Skip to content

[stable34] fix(ftp): handle empty port parameter and ensure strictly numeric ports - #63816

Merged
AndyScherzinger merged 1 commit into
stable34from
backport/63161/stable34
Sep 1, 2026
Merged

[stable34] fix(ftp): handle empty port parameter and ensure strictly numeric ports#63816
AndyScherzinger merged 1 commit into
stable34from
backport/63161/stable34

Conversation

@backportbot

@backportbot backportbot Bot commented Aug 31, 2026

Copy link
Copy Markdown

Backport of PR #63161

@backportbot
backportbot Bot requested a review from a team as a code owner August 31, 2026 08:04
@backportbot
backportbot Bot requested review from Altahrim, joshtrichards, leftybournes, provokateurin and sorbaugh and removed request for a team August 31, 2026 08:04
@backportbot backportbot Bot added this to the Nextcloud 34.0.4 milestone Aug 31, 2026
The external storage settings submit an empty string when the Port field is
left blank. `??` only substitutes null or missing values, so `""` was assigned
to $port and passed on to FtpConnection::__construct(), whose $port parameter
is typed int. PHP rejects a non-numeric string there, so adding an FTP storage
without a port ended in a TypeError and an HTTP 500 - after the configuration
had already been saved.

Fall back to the default port of 21 unless the configured value is numeric,
mirroring the guard added for SFTP in #58350. Casting without the check would
not work, because (int)"" is 0 rather than 21.

Co-authored-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: bahman026 <bahman026@gmail.com>
@joshtrichards
joshtrichards force-pushed the backport/63161/stable34 branch from 3032cf4 to 6e039b1 Compare August 31, 2026 19:26
@joshtrichards joshtrichards added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 31, 2026
@AndyScherzinger
AndyScherzinger merged commit 5a4626a into stable34 Sep 1, 2026
167 of 169 checks passed
@AndyScherzinger
AndyScherzinger deleted the backport/63161/stable34 branch September 1, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish bug feature: external storage feedback-requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants