Bug #72853 [NEW]: stream_set_blocking doesn't work
From: giacovelli2k at gmail dot com
Operating system: ubuntu 16.04.2
PHP version: 7.0.9
Package: Streams related
Bug Type: Bug
Bug description:stream_set_blocking doesn't work
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
--
Edit bug report at https://bugs.php.net/bug.php?id=72853&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72853&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72853&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72853&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72853&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72853&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72853&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72853&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72853&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72853&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72853&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72853&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72853&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72853&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72853&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72853&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72853&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72853&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72853&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72853&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72853&r=mysqlcfg
Thread (3 messages)
- giacovelli2k at gmail dot com