Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / standard / tests / streams / bug46024.phpt
blobfdfd03ee2ef977bcc3f85b4dbede9d718347df96
1 --TEST--
2 Bug #46024 stream_select() doesn't return the correct number
3 --SKIPIF--
4 <?php if (!getenv('TEST_PHP_EXECUTABLE')) die("skip TEST_PHP_EXECUTABLE not defined"); ?>
5 --FILE--
6 <?php
7 $php = realpath(getenv('TEST_PHP_EXECUTABLE')); 
8 $pipes = array();
9 $proc = proc_open(
10         "$php -n -i"
11         ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'))
12         ,$pipes, dirname(__FILE__), array(), array('binary_pipes' => true)
14 var_dump($proc);
15 if (!$proc) {
16         exit(1);
18 $r = array($pipes[1]);
19 $w = array($pipes[0]);
20 $e = null;
21 $ret = stream_select($r, $w, $e, 1);
22 var_dump($ret === (count($r) + count($w)));
23 fread($pipes[1], 1);
25 $r = array($pipes[1]);
26 $w = array($pipes[0]);
27 $e = null;
28 $ret = stream_select($r, $w, $e, 1);
29 var_dump($ret === (count($r) + count($w)));
32 foreach($pipes as $pipe) {
33         fclose($pipe);
35 proc_terminate($proc);
36 if (defined('SIGKILL')) {
37         proc_terminate($proc, SIGKILL);
38 } else {
39         proc_terminate($proc);
41 proc_close($proc);
43 --EXPECTF--
44 resource(%d) of type (process)
45 bool(true)
46 bool(true)