ID: 48805 Updated by: ahar...@php.net Reported By: carsten_sttgt at gmx dot de Status: Open Bug Type: Streams related Operating System: * PHP Version: 5.*, 6CVS (2009-07-06) New Comment:
Conveniently, I have a host name (ipv6.adamharvey.name) that only has AAAA records, which simplifies testing somewhat. It has both regular HTTP and Gopher servers -- Gopher's a particularly simple protocol to test (send a newline, get an index), so it's quite useful in this case. :) This appears to be an issue somewhere in the streams code; I can confirm that this is still occurring with the current PHP_5_3 branch (tested on Linux). There's no dependency on whether a host name or IP address are provided; both fail the same way. It's notable that no error information is filled out, socket_stream_create() simply returns false and sets errno to 0. A direct AF_INET6 socket connection works as expected. Tests: HTTP wrapper: <?php var_dump(file_get_contents('http://ipv6.adamharvey.name/')); ?> Output: Warning: file_get_contents(http://ipv6.adamharvey.name/): failed to open stream: operation failed in /tmp/wrapper.php on line 1 Call Stack: 0.0001 629088 1. {main}() /tmp/wrapper.php:0 0.0001 629232 2. file_get_contents() /tmp/wrapper.php:1 bool(false) Stream socket: <?php $errno = $errstr = null; $r = stream_socket_client('tcp://[2002:cfc0:4611::1]:70/', &$errno, &$errstr); if ($r) { fwrite($r, "\r\n"); $data = ''; while ($packet = fread($r, 16384)) { $data .= $packet; } var_dump($data); fclose($r); } else { echo "Error: $errno; $errstr\n"; } ?> Output: Warning: stream_socket_client(): unable to connect to tcp://[2002:cfc0:4611::1]:70/ (Unknown error) in /tmp/stream.php on line 3 Call Stack: 0.0002 634424 1. {main}() /tmp/stream.php:0 0.0002 634856 2. stream_socket_client() /tmp/stream.php:3 Error: 0; Direct socket connection: <?php $sock = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP) or die(socket_strerror(socket_last_error())); socket_connect($sock, '2002:cfc0:4611::1', 70) or die(socket_strerror(socket_last_error())); socket_write($sock, "\r\n"); $data = ''; while ($packet = socket_read($sock, 16384)) { $data .= $packet; } var_dump($data); ?> Output: string(1230) "iFive Minutes / xn--9bi.net 70 <normal Gopher output snipped> " I can't see anything obvious in the 5.2.9 -> 5.2.10 diff that might have caused this, but I'm hardly an expert on the streams code, so this is likely to need someone more qualified to look at it. Hopefully this helps isolate the problem somewhat -- if I can help test this further, please let me know. Previous Comments: ------------------------------------------------------------------------ [2009-07-06 14:08:48] carsten_sttgt at gmx dot de An example may be: ipv6.google.com or ipv6.beijing2008.cn (our in-house company servers are not accessible by the outside world) But don't you think it's easier to test this with a local webserver like Apache? BTW: It doesn't matter if this is an IPv6 only or a dual stack server. Connections with the IPv6 address doesn't work. That's the point. ------------------------------------------------------------------------ [2009-07-06 12:43:35] j...@php.net Can you provide an url to an ipv6 only server? ------------------------------------------------------------------------ [2009-07-05 18:17:14] carsten_sttgt at gmx dot de Also not working on Linux. ------------------------------------------------------------------------ [2009-07-05 18:12:57] carsten_sttgt at gmx dot de Same problem on OS X. ------------------------------------------------------------------------ [2009-07-05 16:45:06] carsten_sttgt at gmx dot de It's also not working with the latest snapshot. (Version: 5.3.1-dev; Sun, 05 Jul 2009 16:08:49 +0000) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/48805 -- Edit this bug report at http://bugs.php.net/?id=48805&edit=1