socket_accept() fails on IPv6 server sockets

Bug #51958 socket_accept() fails on IPv6 server sockets
Submitted: 2010-05-31 18:04 UTC Modified: 2011-03-17 23:23 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: grawity at gmail dot com Assigned: cataphract (profile)
Status: Closed Package: Sockets related
PHP Version: 5.3.2 OS: Windows XP SP3
Private report: No CVE-ID: None

 [2010-05-31 18:04 UTC] grawity at gmail dot com

Description:
------------
When attempting to create an IPv6 server using the socket_*() functions, PHP displays an error when socket_accept() is called:

> [10014]: The system detected an invalid pointer address in attempting to use a pointer argument in a call.

Client IPv6 sockets (socket_connect()) are working.
IPv6 streams, both stream_socket_server() and client(), are working.
Other software (such as Python's socket module) is working.

Problem occurs even with no php.ini is used:
> php -n -d extension="C:\Program Files\PHP\ext\php_sockets.dll" testsock.php

Standard PHP build from http://windows.php.net/ is used:
> PHP 5.3.2 (cli) (built: Mar  3 2010 20:47:01)
> Copyright (c) 1997-2010 The PHP Group
> Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Test script:
---------------
<?php
$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
socket_bind($listenfd, "::1", 13579);
socket_listen($listenfd);
print "Waiting...\n";
$connfd = socket_accept($listenfd);
if ($connfd) print "Accepted connection.\n";


Expected result:
----------------
Waiting...
Accepted connection.

(The script should wait for an IPv6 connection on [::1] (IPv6 localhost) port 13579 and print "Accepted connection." when one is accepted)

Actual result:
--------------
Waiting...
Warning: socket_accept(): unable to accept incoming connection [10014]: The system detected an invalid pointer address in attempting to use a pointer argument in a call.
 in H:\pqi\code\testsock.php on line6

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2011-03-15 00:00 UTC] cataphract@php.net

Fixed in trunk; on hold for 5.3, waiting until after 5.3.6 release.