Commit 6d3c5c67dd1 for php.net
commit 6d3c5c67dd1f3a036f6dfd3492e83cde6a822b71
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Wed Aug 19 23:50:51 2026 +0700
ext/sockets: Fixes CI failure introduced by #23345
diff --git a/ext/sockets/tests/socket_cmsg_space_num_range_64bit.phpt b/ext/sockets/tests/socket_cmsg_space_num_range_64bit.phpt
new file mode 100644
index 00000000000..7168d7e1029
--- /dev/null
+++ b/ext/sockets/tests/socket_cmsg_space_num_range_64bit.phpt
@@ -0,0 +1,21 @@
+--TEST--
+socket_cmsg_space() rejects a $num larger than INT_MAX on 64-bit platforms
+--EXTENSIONS--
+sockets
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE < 8) {
+ die('skip 64-bit only');
+}
+?>
+--FILE--
+<?php
+// $num is range checked before the level/type pair is looked up
+try {
+ socket_cmsg_space(SOL_SOCKET, 0, PHP_INT_MAX);
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+ValueError: socket_cmsg_space(): Argument #3 ($num) must be between -2147483648 and 2147483647
diff --git a/ext/sockets/tests/socket_cmsg_space_return_type.phpt b/ext/sockets/tests/socket_cmsg_space_return_type.phpt
index f8b0b736461..38a70666ed6 100644
--- a/ext/sockets/tests/socket_cmsg_space_return_type.phpt
+++ b/ext/sockets/tests/socket_cmsg_space_return_type.phpt
@@ -31,17 +31,8 @@
echo $e::class, ': ', $e->getMessage(), "\n";
}
-// $num overflows int (64-bit only: PHP_INT_MAX > INT_MAX)
-if (PHP_INT_SIZE >= 8) {
- try {
- socket_cmsg_space(SOL_SOCKET, SCM_RIGHTS, PHP_INT_MAX);
- } catch (Throwable $e) {
- echo $e::class, ': ', $e->getMessage(), "\n";
- }
-}
?>
--EXPECT--
string(3) "int"
ValueError: Pair level 999999 and/or type 999999 is not supported
ValueError: socket_cmsg_space(): Argument #3 ($num) must be greater than or equal to 0
-ValueError: socket_cmsg_space(): Argument #3 ($num) must be between -2147483648 and 2147483647