From: Xavier dot Redon at polytech-lille dot fr Operating system: Linux 2.6 PHP version: 5.1.1 PHP Bug Type: Sockets related Bug description: socket_sendto seems unable to handle IPv6 addresses
Description: ------------ When executing the script below an error occurs. A trace with strace show that the struct sockaddr of the system call sendto is uninitialized (or badly initialized) : sendto(3, "Test Message", 12, 0, {sa_family=0x45a0 /* AF_??? */, sa_data="<\10\20\0\0\0\20\0\0\0\250\376\343\277"}, 16) = -1 EINVAL (Invalid argument) Reproduce code: --------------- <? $sh = socket_create(AF_INET6,SOCK_DGRAM,0); if (socket_bind($sh, '::1', 4242)) { echo "Socket ok\n"; } $buf = 'Test Message'; $len = strlen($buf); if (socket_sendto($sh, $buf, $len, 0x00, '::1', 4000) !== FALSE) { echo "Message sent\n"; } socket_close($sh); ?> Expected result: ---------------- an IPv6 UDP datagram should be sent to the IPv6 loopback address. Actual result: -------------- Warning: socket_sendto(): unable to write to socket [22]: Invalid argument in /tmp/toto.php on line 12 -- Edit bug report at http://bugs.php.net/?id=35490&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35490&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35490&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35490&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35490&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35490&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35490&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35490&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35490&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35490&r=support Expected behavior: http://bugs.php.net/fix.php?id=35490&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35490&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35490&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35490&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35490&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35490&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35490&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35490&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35490&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35490&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35490&r=mysqlcfg