php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63922 stream_select on pipes returned by proc_open returns streams that are not ready
Submitted: 2013-01-06 18:16 UTC Modified: -
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:3 (75.0%)
From: LastDragon at yandex dot ru Assigned:
Status: Open Package: Streams related
PHP Version: 5.4.10 OS: Windows
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-01-06 18:16 UTC] LastDragon at yandex dot ru
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 09:02:23 2014 UTC