Skip to content

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

Merged
AndyScherzinger merged 1 commit into
stable35from
backport/63161/stable35
Sep 1, 2026
Merged

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

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, provokateurin, salmart-dev and sorbaugh and removed request for a team and joshtrichards August 31, 2026 08:04
@backportbot backportbot Bot added this to the Nextcloud 35 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/stable35 branch from a1c6af2 to ff62428 Compare August 31, 2026 10:54
@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 034a698 into stable35 Sep 1, 2026
234 of 238 checks passed
@AndyScherzinger
AndyScherzinger deleted the backport/63161/stable35 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