PHP :: Bug #72853 :: stream_set_blocking doesn't work
| Bug #72853 | stream_set_blocking doesn't work | ||||
|---|---|---|---|---|---|
| Submitted: | 2016-08-16 09:35 UTC | Modified: | 2016-08-17 08:25 UTC | ||
| From: | giacovelli2k at gmail dot com | Assigned: | |||
| Status: | Closed | Package: | Streams related | ||
| PHP Version: | 7.0.9 | OS: | ubuntu 16.04.2 | ||
| Private report: | No | CVE-ID: | None | ||
[2016-08-16 09:35 UTC] giacovelli2k at gmail dot com
Description:
------------
stream_set_blocking() simply doesn't work and block fgets function for retrieve data from stream
Test script:
---------------
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$cwd = '/tmp';
$env = array();
$process = proc_open('uname -a', $descriptorspec, $pipes, $cwd, $env);
if(stream_set_blocking($pipes[1], false)){
echo "Success";
}else{
echo "Failed";
}
var_dump(stream_get_meta_data($pipes[1]));
$out = fgets ($pipes[1], 1024);
echo $out;
if(!$out){
die("ERROR");
}
?>
Expected result:
----------------
Success
array(7) {
["timed_out"]=> bool(false)
["blocked"]=> bool(false)
["eof"]=> bool(false)
["stream_type"]=> string(5) "STDIO"
["mode"]=> string(1) "r"
["unread_bytes"]=> int(0)
["seekable"]=> bool(false)
}
Linux riot 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Actual result:
--------------
Success
array(7) {
["timed_out"]=> bool(false)
["blocked"]=> bool(true)
["eof"]=> bool(false)
["stream_type"]=> string(5) "STDIO"
["mode"]=> string(1) "r"
["unread_bytes"]=> int(0)
["seekable"]=> bool(false)
}
ERROR
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2016-08-17 08:25 UTC] laruence@php.net