[php-src] master: Merge branch 'PHP-8.5'

From: Date: Thu, 16 Jul 2026 20:21:50 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140059@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-07-17T04:17:57+08:00 Commit: https://github.com/php/php-src/commit/51300b7f59fa4ae97015d519c442bb7f581c9769 Raw diff: https://github.com/php/php-src/commit/51300b7f59fa4ae97015d519c442bb7f581c9769.diff Merge branch 'PHP-8.5' * PHP-8.5: ext/sockets: Fix socket_set_option() validation error messages (#22772) Changed paths: M NEWS M ext/sockets/sockets.c M ext/sockets/tests/socket_cmsg_udp_segment.phpt M ext/sockets/tests/socket_set_option_timeo_error.phpt Diff: diff --git a/NEWS b/NEWS index cb10b3be0b6d..e1a8e55de7bc 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,10 @@ PHP NEWS . Fixed bug GH-22681 (Reflection*::__toString() truncates on null bytes). (DanielEScherzer) +- Sockets: + . Fixed socket_set_option() validation error messages for UDP_SEGMENT and + SO_LINGER options. (Weilin Du) + 16 Jul 2026, PHP 8.6.0alpha2 - Core: diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index dbf7f4e6ad4b..ea90c2ae6425 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -2211,7 +2211,7 @@ PHP_FUNCTION(socket_set_option) } if (val_linger < 0 || val_linger > USHRT_MAX) { - zend_argument_value_error(4, "\"%s\" must be between 0 and %d", l_linger, USHRT_MAX); + zend_argument_value_error(4, "\"%s\" must be between 0 and %u", l_linger_key, USHRT_MAX); RETURN_THROWS(); } @@ -2375,8 +2375,8 @@ PHP_FUNCTION(socket_set_option) // UDP segmentation offload maximum size or 0 to disable it if (ov < 0 || ov > USHRT_MAX) { - zend_argument_value_error(4, "must be of between 0 and %u", USHRT_MAX); - RETURN_FALSE; + zend_argument_value_error(4, "must be between 0 and %u", USHRT_MAX); + RETURN_THROWS(); } optlen = sizeof(ov); diff --git a/ext/sockets/tests/socket_cmsg_udp_segment.phpt b/ext/sockets/tests/socket_cmsg_udp_segment.phpt index 679b246ea9d4..38a914066510 100644 --- a/ext/sockets/tests/socket_cmsg_udp_segment.phpt +++ b/ext/sockets/tests/socket_cmsg_udp_segment.phpt @@ -22,5 +22,5 @@ try { } ?> --EXPECT-- -socket_setopt(): Argument #4 ($value) must be of between 0 and 65535 -socket_setopt(): Argument #4 ($value) must be of between 0 and 65535 +socket_setopt(): Argument #4 ($value) must be between 0 and 65535 +socket_setopt(): Argument #4 ($value) must be between 0 and 65535 diff --git a/ext/sockets/tests/socket_set_option_timeo_error.phpt b/ext/sockets/tests/socket_set_option_timeo_error.phpt index 1db5e01c3622..befdfb095855 100644 --- a/ext/sockets/tests/socket_set_option_timeo_error.phpt +++ b/ext/sockets/tests/socket_set_option_timeo_error.phpt @@ -13,6 +13,7 @@ $options_2 = array("sec" => new stdClass(), "usec" => "1"); $options_3 = array("l_onoff" => "aaaa", "l_linger" => "1"); $options_4 = array("l_onoff" => "1", "l_linger" => []); $options_5 = array("l_onoff" => PHP_INT_MAX, "l_linger" => "1"); +$options_6 = array("l_onoff" => "1", "l_linger" => PHP_INT_MAX); try { socket_set_option( $socket, SOL_SOCKET, SO_RCVTIMEO, new stdClass); @@ -56,6 +57,11 @@ try { } catch (\ValueError $e) { echo $e->getMessage() . PHP_EOL; } +try { + socket_set_option( $socket, SOL_SOCKET, SO_LINGER, $options_6); +} catch (\ValueError $e) { + echo $e->getMessage() . PHP_EOL; +} ?> --EXPECTF-- socket_set_option(): Argument #4 ($value) must have key "sec" @@ -64,3 +70,4 @@ Warning: Object of class stdClass could not be converted to int in %s on line %d socket_set_option(): Argument #4 ($value) must be of type array when argument #3 ($option) is SO_RCVTIMEO, string given socket_set_option(): Argument #4 ($value) must be of type array when argument #3 ($option) is SO_LINGER, string given socket_set_option(): Argument #4 ($value) "l_onoff" must be between 0 and %d +socket_set_option(): Argument #4 ($value) "l_linger" must be between 0 and %d

« previous php.cvs (#140059) next »