Bug #74556 [Com]: stream_socket_get_name returns \0 string instead of false
| From: | cpuidle at gmx dot de | Date: | Sat, 07 Oct 2017 10:28:36 +0000 |
| Subject: | Bug #74556 [Com]: stream_socket_get_name returns \0 string instead of false | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211562@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74556&edit=1
ID: 74556
Comment by: cpuidle at gmx dot de
Reported by: cpuidle at gmx dot de
Summary: stream_socket_get_name returns \0 string instead of
false
Status: Closed
Type: Bug
Package: Streams related
Operating System: OSX
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
@pollita@php.net would you kindly explain why this bug has been closed without any comment?
I've tried to provide every analysis I could including PHP sources.
Doesn't that at least deserve a small token of appreciation like an answer?
Disappointed with the culture :(
Previous Comments:
------------------------------------------------------------------------
[2017-05-28 15:52:55] pollita@php.net
Automatic comment on behalf of pollita
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8dcfec9789b4792f7b6b25673274b74bae71b512
Log: Bugfix #74556 stream_socket_get_name() returns empty string
------------------------------------------------------------------------
[2017-05-08 15:32:19] cpuidle at gmx dot de
Description:
------------
When using UNIX sockets, php returns string(1) ''.\\0.'' for client side socket
name of a client socket instead of false.
See https://3v4l.org/VStV6
Internally, stream_socket_get_name
(https://lxr.room11.org/xref/php-src%407.1/ext/standard/streamsfuncs.c) calls
php_stream_xport_get_name
(https://lxr.room11.org/source/s?refs=php_stream_xport_get_name&project=php-src@7.1).
The observed \0 string seems to be a returned empty C string buffer not further checked?
Test script:
---------------
<?php
$s = stream_socket_server('unix:///tmp/demo.sock');
$c = stream_socket_client('unix:///tmp/demo.sock');
var_dump(
stream_socket_get_name($s, true),
stream_socket_get_name($c, false)
);
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
bool(false)
string(1) ""
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74556&edit=1