php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60106 stream_socket_server + long unix socket path = 'Unknown error'
Submitted: 2011-10-20 19:11 UTC Modified: 2012-04-21 08:07 UTC
From: tyrael@php.net Assigned: iliaa
Status: Closed Package: Streams related
PHP Version: 5.4.0beta2 OS: linux debian squeeze 64 bit
Private report: No CVE-ID:
 [2011-10-20 19:11 UTC] tyrael@php.net
Description:
------------
this works:
./sapi/cli/php -r '$file = "/tmp/".str_repeat("a", 
101);stream_socket_server("unix://".$file) && unlink($file);'

this isn't:
./sapi/cli/php -r '$file = "/tmp/".str_repeat("a", 
102);stream_socket_server("unix://".$file) && unlink($file);'

gives me an:

Warning: stream_socket_server(): unable to connect to 
unix:///tmp/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (Unknown error) in Command line code on line 
1

I didn't found any mention in the documentation about restrictions on the length 
of the socket file.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-21 03:51 UTC] laruence@php.net
actullay, there is a limition, 

sys/un.h 

/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket.  */
struct sockaddr_un
  {
    __SOCKADDR_COMMON (sun_);
    char sun_path[108];     /* Path name.  */
  };


I think this issue could mark as doc problem.
 [2011-10-21 08:21 UTC] tyrael@php.net
I'm fine with the idea to mark this as a documentation problem, but maybe we 
should  change the length limit to something more common, like 127 or 255.
what do you think?
 [2011-10-22 10:49 UTC] laruence@php.net
the limition is in socket self, not php, yes PHP can increase the limition, but I 
am afraid it dosen't work too.

but maybe we can throw warning when truncation occurring.
 [2012-03-03 20:36 UTC] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=323852
Log: Fixed bug #60106 (stream_socket_server silently truncates long unix socket paths)
 [2012-03-03 20:36 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-03-03 20:36 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 [2012-03-27 17:26 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da85d5b4a00943a267db910299bdaee04c081c25
Log: Fix bug #61518 skip on windows, fix on linux - ext/standard/tests/streams/bug60106.phpt
 [2012-03-29 04:23 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da85d5b4a00943a267db910299bdaee04c081c25
Log: Fix bug #61518 skip on windows, fix on linux - ext/standard/tests/streams/bug60106.phpt
 [2012-03-29 18:42 UTC] shein@php.net
ext/standard/tests/streams/bug60106.phpt fails for me on all 3 branches.
Please, look also at http://ci.qa.php.net/job/php-src-trunk-matrix-
build/architecture=x86,os=linux-debian-6.0/lastCompletedBuild/testReport/php-
src.ext.standard.tests/streams/bug60106_phpt___Bug_60106__stream_socket_server_si
lently_truncates_long_unix_socket_paths_/
 [2012-04-18 09:45 UTC] laruence@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=67db5de6b215a20683da45a4d45ee715b836832f
Log: Fixed bug #60106 (stream_socket_server silently truncates long unix socket paths)
 [2012-04-21 08:06 UTC] laruence@php.net
Test fixed in git :http://git.php.net/?
p=phpsrc.git;a=commitdiff;h=2e9eb5e32fb489d73cb336730104d507b20d9652
 [2012-04-21 08:07 UTC] laruence@php.net
sorry, previous link is one, http://git.php.net/?p=php-
src.git;a=commitdiff;h=2e9eb5e32fb489d73cb336730104d507b20d9652
 [2012-07-24 23:36 UTC] rasmus@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=67db5de6b215a20683da45a4d45ee715b836832f
Log: Fixed bug #60106 (stream_socket_server silently truncates long unix socket paths)
 [2013-11-17 09:33 UTC] laruence@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=67db5de6b215a20683da45a4d45ee715b836832f
Log: Fixed bug #60106 (stream_socket_server silently truncates long unix socket paths)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 19:01:53 2014 UTC