php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64330 stream_socket_server() creates wrong Abstract Namespace UNIX sockets
Submitted: 2013-03-01 08:20 UTC Modified: -
From: a dot yamanoi at gmail dot com Assigned:
Status: Closed Package: Streams related
PHP Version: 5.4.12 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: a dot yamanoi at gmail dot com
New email:
PHP Version: OS:

 

 [2013-03-01 08:20 UTC] a dot yamanoi at gmail dot com
Description:
------------
stream_socket_server("unix://\x00/foo/bar") doesn't bind
a UNIX domain socket to the abstract namespace correctly.

The actual namespace string seems to be padded right with "\x00"s.

e.g.
"\x00/foo/bar\x00\x00...\x00"

So the stream_socket_client("unix://\x00/foo/bar") test below fails.
According to Bug #44127, stream_socket_client() works fine now.

The problem occurs in PHP 5.4.12 and the latest 5.4 snap(Built on: Mar 01, 2013 
02:30 UTC).

Test script:
---------------
<?php
$server = stream_socket_server("unix://\x00/MyBindName");
$client = stream_socket_client("unix://\x00/MyBindName");
if ($client) {
    echo "ok\n";
}
?>

Expected result:
----------------
ok


Actual result:
--------------
PHP Warning: stream_socket_client(): unable to connect to unix://\0/MyBindName 
(Connection refused) in ...

Patches

quick-fix-abstract-ns-xp_socket.c.patch (last revision 2013-03-01 09:02 UTC by a dot yamanoi at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-02 09:16 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91a9d24aa30507e6c7d8937db2de24394f0ce121
Log: Fix bug #64330
 [2014-04-02 09:16 UTC] mike@php.net
-Status: Open +Status: Closed
 [2014-04-03 08:02 UTC] ab@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91a9d24aa30507e6c7d8937db2de24394f0ce121
Log: Fix bug #64330
 [2014-04-03 08:04 UTC] ab@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91a9d24aa30507e6c7d8937db2de24394f0ce121
Log: Fix bug #64330
 [2014-04-10 04:47 UTC] tyrael@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91a9d24aa30507e6c7d8937db2de24394f0ce121
Log: Fix bug #64330
 [2014-10-07 23:15 UTC] stas@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=91a9d24aa30507e6c7d8937db2de24394f0ce121
Log: Fix bug #64330
 [2014-10-07 23:26 UTC] stas@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=91a9d24aa30507e6c7d8937db2de24394f0ce121
Log: Fix bug #64330
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC