#47918 [Com]: stream_set_blocking() does not work with pipes opened with proc_open()
| From: | morrisdavidd at gmail dot com | Date: | Tue, 28 Jul 2009 09:47:05 +0000 |
| Subject: | #47918 [Com]: stream_set_blocking() does not work with pipes opened with proc_open() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-140356@lists.php.net to get a copy of this message | ||
ID: 47918
Comment by: morrisdavidd at gmail dot com
Reported By: RQuadling at GMail dot com
Status: Open
Bug Type: Streams related
Operating System: Windows
PHP Version: 5.*, 6CVS (2009-06-19
New Comment:
I tested this on PHP 5.3 (on Linux) and duplicated the error that the
print_r command shows blocking as true. HOWEVER, the stream does not
block when actually tested... a simple test script can be created by
adding a line and slightly modifying the scripts found at:
http://bugs.php.net/bug.php?id=49084
Previous Comments:
------------------------------------------------------------------------
[2009-06-19 11:12:34] jani@php.net
If it exists below 5.3, the version must state it! Do NOT touch it
again.
------------------------------------------------------------------------
[2009-06-19 09:31:34] RQuadling at GMail dot com
Only worry about 5.3+
------------------------------------------------------------------------
[2009-05-08 09:58:57] RQuadling at GMail dot com
I also tried opening the pipes descriptors like ...
$a_Descriptors = array(0 => array('pipe', 'rn'), 1 =>
array('pipe',
'wn'), 2 => array('pipe', 'wn'));
but no change.
------------------------------------------------------------------------
[2009-04-07 21:50:45] RQuadling at GMail dot com
I tried both 0 and False to set non blocking mode. In all cases the
function returns false and the meta data reports that the pipe is
still in blocking mode.
I've just tried it with PHP 5.2.8 (cli) (built: Dec 8 2008 19:31:23)
(on Windows XP SP3) on my home laptop and the same problem.
------------------------------------------------------------------------
[2009-04-07 12:31:33] RQuadling at GMail dot com
Description:
------------
I'm trying to set non-blocking mode on pipes attached to a process
opened using proc_open.
The documentation and the user notes suggest that what I am doing
should work.
Running this with php -n to remove my ini file settings.
Reproduce code:
---------------
<?php
echo PHP_VERSION, ' ', PHP_OS, ' ', PHP_SAPI, PHP_EOL;
echo 'INI:', php_ini_loaded_file(), PHP_EOL;
// Define the descriptors.
$a_Descriptors = array(0 => array('pipe', 'r'), 1 =>
array('pipe',
'w'), 2 => array('pipe', 'w'));
// Provide a place for the pipes.
$a_Pipes = array();
// Create the thread.
$r_Thread = proc_open("dir c:\\ /b", $a_Descriptors, $a_Pipes, Null,
$_ENV);
// Display the current STDOUT meta data.
print_r(stream_get_meta_data($a_Pipes[1]));
// Try to change the blocking mode to non-blocking.
echo (stream_set_blocking($a_Pipes[1], False) ? 'Successfully' :
'Failed'), ' to set blocking mode to non-blocking', PHP_EOL;
// Display the current STDOUT meta data.
print_r(stream_get_meta_data($a_Pipes[1]));
Expected result:
----------------
5.3.0RC2-dev WINNT cli
INI:
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] => 1
[eof] =>
)
Successfully set blocking mode to non-blocking
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] =>
[eof] =>
)
Actual result:
--------------
5.3.0RC2-dev WINNT cli
INI:
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] => 1
[eof] =>
)
Failed to set blocking mode to non-blocking
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] => 1
[eof] =>
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47918&edit=1