Bug #63922 [NEW]: stream_select on pipes returned by proc_open returns streams that are not ready
| From: | LastDragon at yandex dot ru | Date: | Sun, 06 Jan 2013 18:16:28 +0000 |
| Subject: | Bug #63922 [NEW]: stream_select on pipes returned by proc_open returns streams that are not ready | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-175797@lists.php.net to get a copy of this message | ||
From: LastDragon at yandex dot ru
Operating system: Windows
PHP version: 5.4.10
Package: Streams related
Bug Type: Bug
Bug description:stream_select on pipes returned by proc_open returns streams that are not ready
Description:
------------
This is https://bugs.php.net/bug.php?id=44908
that is still exists... ~5
years :'(
> When using stream_select() on pipes returned by proc_open() in Windows,
input streams that are not ready are returned in the modified $read array.
Test script:
---------------
<?php
// stream_select.php
$cmd = "php stream_select.process.php";
$pipes = array();
$descriptors = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w"), // stderr
);
$process = proc_open($cmd, $descriptors, $pipes);
if (is_resource($process)) {
$read = [$pipes[1], $pipes[2]];
$write = null;
$except = null;
$changed = stream_select($read, $write, $except, null);
var_dump($changed, $read, $write);
}
// stream_select.process.php
<?php
fwrite(STDOUT, 'test');
fflush(STDOUT);
sleep(15);
exit(0);
Expected result:
----------------
int(1)
array(1) {
[0]=>
resource(5) of type (stream)
}
NULL
Actual result:
--------------
int(2)
array(2) {
[0]=>
resource(5) of type (stream)
[1]=>
resource(6) of type (stream)
}
NULL
--
Edit bug report at https://bugs.php.net/bug.php?id=63922&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63922&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63922&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63922&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63922&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63922&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63922&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63922&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63922&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63922&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63922&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63922&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63922&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63922&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63922&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63922&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63922&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63922&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63922&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63922&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63922&r=mysqlcfg