[php-src] master: ext/sockets: Fix TCP_USER_TIMEOUT range error message

Weilin Du <[email protected]> Fri, 17 Jul 2026 12:05:51 +0000
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Weilin Du (LamentXU123)
Date: 2026-07-17T20:05:20+08:00

Commit: https://github.com/php/php-src/commit/583403a9a0e965c64d3152ff73c3e208375db507
Raw diff: https://github.com/php/php-src/commit/583403a9a0e965c64d3152ff73c3e208375db507.diff

ext/sockets: Fix TCP_USER_TIMEOUT range error message

This is a follow-up commit to 3882f55 where all
malformed error message in the socket extension
in 8.5 has been fixed. This fixed a specific one appears
only in the master branch.

Changed paths:
  M  NEWS
  M  ext/sockets/sockets.c
  M  ext/sockets/tests/socket_setoption_tcpusertimeout_32bit.phpt
  M  ext/sockets/tests/socket_setoption_tcpusertimeout_64bit.phpt


Diff:

diff --git a/NEWS b/NEWS
index b63ae8a81c99..c548f32d052a 100644
--- a/NEWS
+++ b/NEWS
@@ -30,7 +30,7 @@ PHP                                                                        NEWS
 
 - Sockets:
   . Fixed socket_set_option() validation error messages for UDP_SEGMENT and
-    SO_LINGER options. (Weilin Du)
+    TCP_USER_TIMEOUT, and SO_LINGER options. (Weilin Du)
 
 16 Jul 2026, PHP 8.6.0alpha2
 
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index ea90c2ae6425..9c9c86ba6733 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -2154,7 +2154,7 @@ PHP_FUNCTION(socket_set_option)
 
 			// TCP_USER_TIMEOUT unsigned int
 			if (timeout < 0 || timeout > UINT_MAX) {
-				zend_argument_value_error(4, "must be of between 0 and %u", UINT_MAX);
+				zend_argument_value_error(4, "must be between 0 and %u", UINT_MAX);
 				RETURN_THROWS();
 			}
 
diff --git a/ext/sockets/tests/socket_setoption_tcpusertimeout_32bit.phpt b/ext/sockets/tests/socket_setoption_tcpusertimeout_32bit.phpt
index 3f12120e54d8..05970b719874 100644
--- a/ext/sockets/tests/socket_setoption_tcpusertimeout_32bit.phpt
+++ b/ext/sockets/tests/socket_setoption_tcpusertimeout_32bit.phpt
@@ -29,6 +29,6 @@ var_dump($retval_3 === $timeout);
 socket_close($socket);
 ?>
 --EXPECTF--
-socket_setopt(): Argument #4 ($value) must be of between 0 and %d
+socket_setopt(): Argument #4 ($value) must be between 0 and %d
 bool(true)
 bool(true)
diff --git a/ext/sockets/tests/socket_setoption_tcpusertimeout_64bit.phpt b/ext/sockets/tests/socket_setoption_tcpusertimeout_64bit.phpt
index 8dbb7f80e48b..894a24d2a49b 100644
--- a/ext/sockets/tests/socket_setoption_tcpusertimeout_64bit.phpt
+++ b/ext/sockets/tests/socket_setoption_tcpusertimeout_64bit.phpt
@@ -35,7 +35,7 @@ var_dump($retval_3 === $timeout);
 socket_close($socket);
 ?>
 --EXPECTF--
-socket_setopt(): Argument #4 ($value) must be of between 0 and %d
-socket_setopt(): Argument #4 ($value) must be of between 0 and %d
+socket_setopt(): Argument #4 ($value) must be between 0 and %d
+socket_setopt(): Argument #4 ($value) must be between 0 and %d
 bool(true)
 bool(true)