Bug #72853 [Opn->Ana]: stream_set_blocking doesn't work

From: Date: Wed, 17 Aug 2016 08:25:03 +0000
Subject: Bug #72853 [Opn->Ana]: stream_set_blocking doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203338@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72853&edit=1 ID: 72853 Updated by: laruence@php.net Reported by: giacovelli2k at gmail dot com Summary: stream_set_blocking doesn't work -Status: Open +Status: Analyzed Type: Bug Package: Streams related Operating System: ubuntu 16.04.2 PHP Version: 7.0.9 Block user comment: N Private report: N New Comment: the real problem is , the fd is actually has been set to non-blocking mode, but get_meta_data returns "blocked -> 1". and that is because plain_wrapper doesn't implement PHP_STREAM_OPTION_META_DATA_API.. Previous Comments: ------------------------------------------------------------------------ [2016-08-16 09:35:28] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72853&edit=1

« previous php.bugs (#203338) next »