|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64179 proc_open: all file handles are connected to same pty
Submitted: 2013-02-09 23:15 UTC Modified: 2014-04-03 11:40 UTC
From: php-bugs at dennis dot birkholz dot biz Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.4.11 OS: Linux
Private report: No CVE-ID: None
 [2013-02-09 23:15 UTC] php-bugs at dennis dot birkholz dot biz
If you open a program with proc_open and you connect both stdout and stderr of that program to a pty, the same pty is used. If you use select_stream on both stdout and stderr, select marks both as ready and you can not distinguish which one hash data as you can read from both resources.

Test script:
$descriptorspec = array(
	0 => array("pipe", "r"),
	1 => array("pty"),
	2 => array("pty"),

$proc = proc_open("programpath", $descriptorspec, $handles = array());

stream_select($read = array($handles[1], $handles[2]), $write = null, $urgent = null, $timeout = 10);

// $read now contains $handles[1] AND $handles[2], does not matter where the data was written to


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-03 11:40 UTC]
-Status: Open +Status: Not a bug
 [2014-04-03 11:40 UTC]
There's not even PTY support in stock PHP.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 29 11:01:31 2024 UTC