php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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
Status: Closed Package: Sockets related
PHP Version: 5.3.2 OS: Windows XP SP3
Private report: No CVE-ID:
 [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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-06 20:47 UTC] cataphract@php.net
-Assigned To: +Assigned To: cataphract
 [2011-03-14 23:59 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=309238
Log: - Fixed bug #51958: socket_accept() fails on IPv6 sockets.
#On hold for 5.3
 [2011-03-15 00:00 UTC] cataphract@php.net
-Status: Assigned +Status: Suspended
 [2011-03-15 00:00 UTC] cataphract@php.net
Fixed in trunk; on hold for 5.3, waiting until after 5.3.6 release.
 [2011-03-17 23:23 UTC] cataphract@php.net
-Status: Suspended +Status: Closed
 [2011-03-17 23:23 UTC] cataphract@php.net
Fix merged to 5.3.
 [2011-03-20 23:12 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=309486
Log: - Fixed SKIPIF section of bug51958.phpt.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 00:01:21 2014 UTC