1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 06:21:12 +02:00
Files
archived-php-src/ext/standard/tests/streams/bug76136.phpt
seliver 95013042bf Fixed bug #76136 (stream_socket_get_name enclosed IPv6 in brackets)
The IPv6 IP of a socket is provided by inet_ntop() as a string, but
this function doesn't enclose the IP in brackets. This patch adds
them in the php_network_populate_name_from_sockaddr() function.
2018-07-07 11:47:50 +02:00

20 lines
470 B
PHP

--TEST--
Bug #76136: stream_socket_get_name should enclose IPv6 in brackets
--SKIPIF--
<?php
@stream_socket_client('tcp://[::1]:0', $errno);
if ($errno != 111) {
die('skip IPv6 is not supported.');
}
?>
--FILE--
<?php
$server = stream_socket_server("tcp://[::1]:1337/");
echo stream_socket_get_name($server, false).PHP_EOL;
$server = stream_socket_server("tcp://127.0.0.1:1337/");
echo stream_socket_get_name($server, false);
?>
--EXPECT--
[::1]:1337
127.0.0.1:1337