ID: 50415 Comment by: mbeeching at btinternet dot com Reported By: mbeeching at btinternet dot com Status: Feedback Bug Type: Network related Operating System: FreeBSD 7.0 PHP Version: 5.2.11 New Comment:
OK thank you, that solves the first of the 2 issues but for the second I still receive the "failed to bind to" warning: [j...@alpha ~/working/php]$ php -v PHP 5.2.12RC4-dev (cli) (built: Dec 9 2009 08:16:56) <-- snip --> [j...@alpha ~/working/php]$ php test.php Warning: stream_socket_client(): failed to bind to '2001:470:1f09:11c::6a6f:6265:0', system said: Can't assign requested address in /usr/home/jobe/working/php/test.php on line 8 Previous Comments: ------------------------------------------------------------------------ [2009-12-08 21:54:08] j...@php.net Please try using this snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2009-12-08 20:15:04] mbeeching at btinternet dot com Description: ------------ OK, firstly, without a context paramter specifying a bindto, stream_socket_client() fails to connect to IPv6 IP's with the following warning: Warning: stream_socket_client(): unable to connect to tcp://[2001:470:1f09:11c:6d6b:7061:7373:7764]:6667 (Unknown error) in /usr/home/jobe/working/php/test.php on line 8 Secondly when you use a stream context as returned by stream_context_create() to specify an IPv6 IP or :: (the 0 of IPv6) address and port to bind a client connection, stream_socket_client() always responds with the following warning: Warning: stream_socket_client(): failed to bind to '2001:470:1f09:11c:0:0:6a6f:6265:0', system said: Can't assign requested address in /usr/home/jobe/working/php/test.php on line 8 Now I can confirm the IPv6 address 2001:470:1f09:11c::6a6f:6265 IS available on a local interface as I have other applications using it. Also the connection IS established, but is NOT bound to the IPv6 IP specified. Reproduce code: --------------- For first issue: $fp = stream_socket_client("tcp://[2001:470:1f09:11c:6d6b:7061:7373:7764]:6667", $errno, $errstr, 30); if (!$fp) { die("$errstr ($errno)\n"); } For second issue: $opts = array('socket' => array('bindto' => '[2001:470:1f09:11c::6a6f:6265]:0')); $ctx = stream_context_create($opts); $fp = stream_socket_client("tcp://[2001:470:1f09:11c:6d6b:7061:7373:7764]:6667", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ctx); if (!$fp) { die("$errstr ($errno)\n"); } Expected result: ---------------- For the first issue I expect stream_socket_client() to successfully connect to the IPv6 IP specified binding to [::]:0 in the same way it binds to 0:0 for IPv4 For the second issue I expect stream_socket_client() to successfully connect to the IPv6 IP specified binding to the context's IPv6 IP specification. Actual result: -------------- For the first issue no connection is established and a warning is issued. For the second issue a warning is issued, the connection is established, but is not bound to the IPv6 IP specified. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50415&edit=1