[php-src] master: Fix GH-11662: Skip multicast test when unavailable
| From: | Pratik Bhujel via David Carlier | Date: | Tue, 22 Sep 2026 08:40:53 +0000 |
| Subject: | [php-src] master: Fix GH-11662: Skip multicast test when unavailable | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141369@lists.php.net to get a copy of this message | ||
Author: Pratik Bhujel (prateekbhujel)
Committer: David Carlier (devnexen)
Date: 2026-09-22T09:40:01+01:00
Commit: https://github.com/php/php-src/commit/a1a7bd4b8b1b0eaccac025ce3fa7741ecae6c252
Raw diff: https://github.com/php/php-src/commit/a1a7bd4b8b1b0eaccac025ce3fa7741ecae6c252.diff
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
Changed paths:
M ext/sockets/tests/bug63000.phpt
Diff:
diff --git a/ext/sockets/tests/bug63000.phpt b/ext/sockets/tests/bug63000.phpt
index 04265638a260..99723d68cdca 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);