php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74458 stream_socket_get_name returns \0 instead of false
Submitted: 2017-04-17 10:06 UTC Modified: 2017-05-08 15:32 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: cpuidle at gmx dot de Assigned:
Status: Closed Package: Streams related
PHP Version: 7.1.4 OS: OSX
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cpuidle at gmx dot de
New email:
PHP Version: OS:

 

 [2017-04-17 10:06 UTC] 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'>'&#0;'</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.''

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-17 10:07 UTC] cpuidle at gmx dot de
Same behaviour with php 7.1.3
 [2017-04-17 11:26 UTC] cpuidle at gmx dot de
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?
 [2017-05-08 15:32 UTC] cpuidle at gmx dot de
-Status: Open +Status: Closed
 [2017-05-08 15:32 UTC] cpuidle at gmx dot de
Superseeded by https://bugs.php.net/bug.php?id=74556
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 18:01:30 2024 UTC