[PHP-CVS] [php-src] master: ext/sockets: Fixes CI failure introduced by #23345

[email protected] (NickSdot via GitHub)
Newsgroups php.cvs
Message-ID <[email protected]>
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: devnexen
Date: 2026-08-19T17:50:51+01:00

Commit: https://github.com/php/php-src/commit/6d3c5c67dd1f3a036f6dfd3492e83cde6a822b71
Raw diff: https://github.com/php/php-src/commit/6d3c5c67dd1f3a036f6dfd3492e83cde6a822b71.diff

ext/sockets: Fixes CI failure introduced by #23345

Changed paths:
  A  ext/sockets/tests/socket_cmsg_space_num_range_64bit.phpt
  M  ext/sockets/tests/socket_cmsg_space_return_type.phpt


Diff:

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 000000000000..7168d7e1029e
--- /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 f8b0b7364611..38a70666ed61 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 @@ try {
     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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.