Edit report at https://bugs.php.net/bug.php?id=65808&edit=1

 ID:                 65808
 Updated by:         m...@php.net
 Reported by:        wzis at hotmail dot com
 Summary:            the socket_connect() won't work with IPv6 address
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            Sockets related
 Operating System:   Linux
 PHP Version:        5.5.4
-Assigned To:        
+Assigned To:        mike
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2013-10-02 10:11:47] wzis at hotmail dot com

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 this bug report at https://bugs.php.net/bug.php?id=65808&edit=1

Reply via email to