From ba0a1c6391093b23914cc6ec17984008967abf66 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 2 Sep 2012 23:40:08 +0200 Subject: [PATCH] Bug #63000: MCAST_JOIN_GROUP on OSX is broken The multicast support in PHP 5.4 makes use of MCAST_JOIN_GROUP if it is present. The problem is that OSX 10.7 added the constant, but did not correctly implement the feature. This causes the setsockopt call to fail. The solution to the problem is to not use MCAST_JOIN_GROUP on OSX. For reference, this was also done in VLC: * http://trac.videolan.org/vlc/ticket/6104#comment:19 --- ext/sockets/multicast.h | 5 +++-- ext/sockets/tests/mcast_osx.phpt | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 ext/sockets/tests/mcast_osx.phpt diff --git a/ext/sockets/multicast.h b/ext/sockets/multicast.h index ccd9b1d2a8e91..5619c9c7fb293 100644 --- a/ext/sockets/multicast.h +++ b/ext/sockets/multicast.h @@ -19,11 +19,12 @@ /* $Id$ */ #if defined(MCAST_JOIN_GROUP) && \ - (!defined(PHP_WIN32) || (_WIN32_WINNT >= 0x600 && SOCKETS_ENABLE_VISTA_API)) + (!defined(PHP_WIN32) || (_WIN32_WINNT >= 0x600 && SOCKETS_ENABLE_VISTA_API)) && \ + !defined(__APPLE__) #define RFC3678_API 1 /* has block/unblock and source membership, in this case for both IPv4 and IPv6 */ #define HAS_MCAST_EXT 1 -#elif defined(IP_ADD_SOURCE_MEMBERSHIP) +#elif defined(IP_ADD_SOURCE_MEMBERSHIP) && !defined(__APPLE__) /* has block/unblock and source membership, but only for IPv4 */ #define HAS_MCAST_EXT 1 #endif diff --git a/ext/sockets/tests/mcast_osx.phpt b/ext/sockets/tests/mcast_osx.phpt new file mode 100644 index 0000000000000..c806ba4c08787 --- /dev/null +++ b/ext/sockets/tests/mcast_osx.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #63000: Multicast on OSX +--SKIPIF-- + '224.0.0.251', + "interface" => 0, +)); +var_dump($so); +--EXPECTF-- +bool(true)