From: mbeeching at btinternet dot com
Operating system: FreeBSD 7.0
PHP version: 5.2.11
PHP Bug Type: Network related
Bug description: stream_socket_client() IPv6 issues
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 bug report at http://bugs.php.net/?id=50415&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50415&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50415&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50415&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50415&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50415&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50415&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50415&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50415&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50415&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50415&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50415&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50415&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50415&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50415&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50415&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50415&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50415&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50415&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50415&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50415&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50415&r=mysqlcfg