From: wzis at hotmail dot com Operating system: Linux PHP version: 5.5.4 Package: Sockets related Bug Type: Bug Bug description:the socket_connect() won't work with IPv6 address
Description: ------------ No matter give fe80::a00:27ff:fe3d:af20 or fe80::a00:27ff:fe3d:af20%eth0 as the address, the socket_connect will just fail. >From strace and the PHP source code, what I found is the sin6_scope_id always equals to 0, while with telnet when passed in fe80::a00:27ff:fe3d:af20%eth0, from strace, we got sin6_scope_id=if_nametoindex("eth0"). So the socket_connect code needs be changed for proper IPv6 support. Test script: --------------- #!/usr/bin/php <?php $sock=socket_create(AF_INET6, SOCK_STREAM, 0); if(socket_connect($sock, $argv[1], $argv[2])) echo "Connected to ".$argv[1]." port ".$argv[2]; ?> Expected result: ---------------- If you run the script with ./phpscript 2606:4100:3880:1250::100 80 You should see "Connected to 2606:4100:3880:1250::100 port 80" Actual result: -------------- PHP Warning: socket_connect(): unable to connect [22]: Invalid argument in phpscript on line 4. -- Edit bug report at https://bugs.php.net/bug.php?id=65808&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65808&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65808&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65808&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65808&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65808&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65808&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65808&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65808&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65808&r=support Expected behavior: https://bugs.php.net/fix.php?id=65808&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65808&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65808&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65808&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65808&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65808&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65808&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65808&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65808&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65808&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65808&r=mysqlcfg