ext/ftp: apply the connect timeout ceiling to the remaining entry points#22767
Closed
iliaal wants to merge 1 commit into
Closed
ext/ftp: apply the connect timeout ceiling to the remaining entry points#22767iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
iliaal
added a commit
to iliaal/php-src
that referenced
this pull request
Jul 16, 2026
phpGH-20601 capped the timeout in ftp_connect() so a value that overflows the timeval conversion cannot reach php_network_set_limit_time(). ftp_ssl_connect() and ftp_set_option(FTP_TIMEOUT_SEC) kept rejecting only non-positive values, so PHP_INT_MAX still reached ftp_open() and my_poll() through them. Apply the same bound to both. ftp_ssl_connect() with PHP_INT_MAX hung before this rather than reporting the bad argument. Closes phpGH-22767
iliaal
force-pushed
the
ftp-ss001-ssl-timeout-cap
branch
from
July 16, 2026 16:24
274cbec to
fc3018d
Compare
Member
|
Can you factor out the maximum constant to a define or something like that? |
iliaal
added a commit
to iliaal/php-src
that referenced
this pull request
Jul 16, 2026
phpGH-20601 capped the timeout in ftp_connect() so a value that overflows the timeval conversion cannot reach php_network_set_limit_time(). ftp_ssl_connect() and ftp_set_option(FTP_TIMEOUT_SEC) kept rejecting only non-positive values, so PHP_INT_MAX still reached ftp_open() and my_poll() through them. Apply the same bound to both, factored into a shared PHP_FTP_TIMEOUT_SEC_MAX macro. ftp_ssl_connect() with PHP_INT_MAX hung before this rather than reporting the bad argument. Closes phpGH-22767
iliaal
force-pushed
the
ftp-ss001-ssl-timeout-cap
branch
from
July 16, 2026 23:54
fc3018d to
616205a
Compare
Contributor
Author
|
Factored into |
ndossche
approved these changes
Jul 17, 2026
devnexen
reviewed
Jul 17, 2026
| require 'server.inc'; | ||
|
|
||
| $ftp = ftp_connect('127.0.0.1', $port); | ||
| ftp_login($ftp, 'user', 'pass'); |
Member
There was a problem hiding this comment.
nit: it seems you need to invert this line and the next ?
phpGH-20601 capped the timeout in ftp_connect() so a value that overflows the timeval conversion cannot reach php_network_set_limit_time(). ftp_ssl_connect() and ftp_set_option(FTP_TIMEOUT_SEC) kept rejecting only non-positive values, so PHP_INT_MAX still reached ftp_open() and my_poll() through them. Apply the same bound to both, factored into a shared PHP_FTP_TIMEOUT_SEC_MAX macro. ftp_ssl_connect() with PHP_INT_MAX hung before this rather than reporting the bad argument. Closes phpGH-22767
iliaal
force-pushed
the
ftp-ss001-ssl-timeout-cap
branch
from
July 17, 2026 18:45
616205a to
3c88014
Compare
devnexen
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GH-20601 capped the timeout in
ftp_connect()so a value that overflows the timeval conversion cannot reachphp_network_set_limit_time().ftp_ssl_connect()andftp_set_option(FTP_TIMEOUT_SEC)kept rejecting only non-positive values, so PHP_INT_MAX still reached ftp_open() and my_poll() through them. Both now apply the same bound.The three entry points before this change:
Floor PHP-8.4, matching where GH-20601 landed.