Bug #74458 [Com]: stream_socket_get_name returns \0 instead of false
| From: | cpuidle at gmx dot de | Date: | Mon, 17 Apr 2017 11:27:01 +0000 |
| Subject: | Bug #74458 [Com]: stream_socket_get_name returns \0 instead of false | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208619@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74458&edit=1
ID: 74458
Comment by: cpuidle at gmx dot de
Reported by: cpuidle at gmx dot de
Summary: stream_socket_get_name returns \0 instead of false
Status: Open
Type: Bug
Package: Streams related
Operating System: OSX
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
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?
Previous Comments:
------------------------------------------------------------------------
[2017-04-17 10:07:12] cpuidle at gmx dot de
Same behaviour with php 7.1.3
------------------------------------------------------------------------
[2017-04-17 10:06:42] cpuidle at gmx dot de
Description:
------------
stream_socket_get_name should return false rather than a \0 string:
<pre class='xdebug-var-dump' dir='ltr'>
<small>/Users/andig/Documents/htdocs/vz/vendor/react/socket/src/Connection.php:44:</small><small>string</small>
<font color='#cc0000'>'�'</font>
<i>(length=1)</i>
</pre>
Test script:
---------------
$address = @stream_socket_get_name($stream, true);
ob_start();
var_dump($address);
$s=ob_get_clean();
error_log($s);
Expected result:
----------------
return false
Actual result:
--------------
return ''.\0.''
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74458&edit=1