Bug #74556 [Opn->Csd]: stream_socket_get_name returns \0 string instead of false

From: Date: Sun, 28 May 2017 15:52:59 +0000
Subject: Bug #74556 [Opn->Csd]: stream_socket_get_name returns \0 string instead of false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209294@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 Updated by: pollita@php.net Reported by: cpuidle at gmx dot de Summary: stream_socket_get_name returns \0 string instead of false -Status: Open +Status: Closed Type: Bug Package: Streams related Operating System: OSX PHP Version: 7.1.4 Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#209294) next »