xref: /PHP-7.2/ext/sockets/tests/bug51958.phpt (revision 3f72c77c)
1--TEST--
2Bug #51958: socket_accept() fails on IPv6 server sockets
3--SKIPIF--
4<?php
5if (!extension_loaded('sockets')) {
6    die('skip sockets extension not available.');
7}
8if (!defined('IPPROTO_IPV6')) {
9	die('skip IPv6 not available.');
10}
11if (PHP_OS != "WINNT")
12	die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
13--FILE--
14<?php
15$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
16socket_bind($listenfd, "::1", 13579);
17socket_listen($listenfd);
18socket_set_nonblock($listenfd);
19$connfd = @socket_accept($listenfd);
20echo socket_last_error();
21--EXPECT--
2210035
23