From:             igor at wiedler dot ch
Operating system: Mac OSX 10.7, 10.8
PHP version:      5.4.6
Package:          Sockets related
Bug Type:         Bug
Bug description:MCAST_JOIN_GROUP on OSX is broken

Description:
------------
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.

Test script:
---------------
<?php
if (!extension_loaded('sockets')) {
    die('skip sockets extension not available.');
}
if (PHP_OS !== 'Darwin') {
    die('is not OSX.');
}

$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($socket, '0.0.0.0', 31057);

$so = socket_set_option($socket, IPPROTO_IP, MCAST_JOIN_GROUP, array(
    "group" => '224.0.0.251',
    "interface" => 0,
));
var_dump($so);


Expected result:
----------------
bool(true)

Actual result:
--------------
PHP Warning:  socket_set_option(): unable to set socket option [22]:
Invalid 
argument in /Users/igor/code/react-mdns-userland/src/React/Mdns/Client.php
on 
line 27
PHP Stack trace:
PHP   1. {main}()
/Users/igor/code/react-mdns-userland/examples/client.php:0
PHP   2. React\Mdns\Client->query() /Users/igor/code/react-mdns-
userland/examples/client.php:10
PHP   3. socket_set_option() /Users/igor/code/react-mdns-
userland/src/React/Mdns/Client.php:27

bool(false)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63000&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=63000&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=63000&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=63000&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=63000&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=63000&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=63000&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=63000&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=63000&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=63000&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=63000&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=63000&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=63000&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=63000&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=63000&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=63000&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=63000&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=63000&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=63000&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=63000&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=63000&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=63000&r=mysqlcfg

Reply via email to