|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-05-08 15:32 UTC] 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) "" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Hrmmm.... Multiple layered things here. How about: if ((ZSTR_LEN(name) == 0) || ((ZSTR_LEN(name) == 1) && (ZSTR_VAL(name)[0] == 0))) { zend_string_release(name); RETURN_FALSE; } That would return anything using an actual abstract socket path "\0/tmp/foo" but deal with the case where Mac returns "\0" for an unbound name,