|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-17 08:25 UTC] laruence@php.net
-Status: Open
+Status: Analyzed
[2016-08-17 08:25 UTC] laruence@php.net
[2016-08-17 09:15 UTC] laruence@php.net
[2016-08-17 09:15 UTC] laruence@php.net
-Status: Analyzed
+Status: Closed
[2016-10-17 10:09 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
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