Commit a1a7bd4b8b1 for php.net
commit a1a7bd4b8b1b0eaccac025ce3fa7741ecae6c252
Author: Pratik Bhujel <prateekbhujelpb@gmail.com>
Date: Tue Sep 22 12:59:17 2026 +0545
Fix GH-11662: Skip multicast test when unavailable
The test assumes that IPv4 multicast is available. In an isolated Linux
network namespace, joining the group fails before the test starts.
Probe that capability in SKIPIF and skip the test when it is unavailable.
Close GH-23838
diff --git a/ext/sockets/tests/bug63000.phpt b/ext/sockets/tests/bug63000.phpt
index 04265638a26..99723d68cdc 100644
--- a/ext/sockets/tests/bug63000.phpt
+++ b/ext/sockets/tests/bug63000.phpt
@@ -2,6 +2,23 @@
Bug #63000: Multicast on OSX
--EXTENSIONS--
sockets
+--SKIPIF--
+<?php
+$socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
+if ($socket === false) {
+ die('skip unable to create IPv4 UDP socket');
+}
+$so = @socket_set_option($socket, IPPROTO_IP, MCAST_JOIN_GROUP, [
+ 'group' => '224.0.0.251',
+ 'interface' => 0,
+]);
+if ($so === false) {
+ $errno = socket_last_error($socket);
+ if (in_array($errno, [SOCKET_ENODEV, SOCKET_ENXIO, SOCKET_EADDRNOTAVAIL], true)) {
+ die('skip no multicast-capable interface: ' . socket_strerror($errno));
+ }
+}
+?>
--FILE--
<?php
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);