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: 2014-09-29 14:49 UTC
Votes:7
Avg. Score:5.0 ± 0.0
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:5 (83.3%)
From: LastDragon at yandex dot ru Assigned:
Status: Wont fix Package: Streams related
PHP Version: 5.4.10 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: LastDragon at yandex dot ru
New email:
PHP Version: OS:

 

 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-29 14:49 UTC] ab@php.net
-Status: Open +Status: Wont fix
 [2014-09-29 14:49 UTC] ab@php.net
see bug #47918
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC