[php-src] PR #23431: Fix wrong argument number in fsockopen/pfsockopen timeout error

From: Date: Mon, 24 Aug 2026 07:11:54 +0000
Subject: [php-src] PR #23431: Fix wrong argument number in fsockopen/pfsockopen timeout error
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38098@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23431 Author: lacatoire php_fsockopen_stream() called zend_argument_value_error(6, ...) for the $timeout parameter, but $timeout is the **5th** argument. Because get_function_arg_name(func, arg_num) returns NULL when arg_num exceeds the actual argument count, the error message reported the wrong number and dropped the parameter name. The format string also used ZEND_ULONG_FMT (which expects a zend_ulong) but received a double expression — undefined behavior in C. This is fixed by adding a (zend_ulong) cast. Before: ``` ValueError: fsockopen(): Argument #6 must be -1 or between 0 and 4294967295 ``` After: ``` ValueError: fsockopen(): Argument #5 ($timeout) must be -1 or between 0 and 18446744073709 ``` The same fix applies to pfsockopen(), which delegates to the same internal helper. A regression test is included; it does not require network connectivity since the ValueError is raised before any connection attempt.

« previous php.git-pulls (#38098) next »