Bug #74556 [NEW]: stream_socket_get_name returns \0 string instead of false

From: Date: Mon, 08 May 2017 15:32:22 +0000
Subject: Bug #74556 [NEW]: stream_socket_get_name returns \0 string instead of false
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208999@lists.php.net to get a copy of this message
From: cpuidle at gmx dot de Operating system: OSX PHP version: 7.1.4 Package: Streams related Bug Type: Bug Bug description:stream_socket_get_name returns \0 string instead of false 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 bug report at https://bugs.php.net/bug.php?id=74556&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74556&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74556&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74556&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74556&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74556&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74556&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74556&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74556&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74556&r=support Expected behavior: https://bugs.php.net/fix.php?id=74556&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74556&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74556&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74556&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74556&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74556&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74556&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74556&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74556&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74556&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74556&r=mysqlcfg

« previous php.bugs (#208999) next »