1--TEST--
2Null pipes in proc_open()
3--FILE--
4<?php
5
6$php = getenv('TEST_PHP_EXECUTABLE');
7$cmd = [$php, '-r', 'echo "Test"; fprintf(STDERR, "Error");'];
8
9$proc = proc_open($cmd, [1 => ['null'], 2 => ['pipe', 'w']], $pipes);
10var_dump($pipes);
11var_dump(stream_get_contents($pipes[2]));
12proc_close($proc);
13
14$proc = proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['null']], $pipes);
15var_dump($pipes);
16var_dump(stream_get_contents($pipes[1]));
17proc_close($proc);
18
19?>
20--EXPECT--
21array(1) {
22  [2]=>
23  resource(4) of type (stream)
24}
25string(5) "Error"
26array(1) {
27  [1]=>
28  resource(6) of type (stream)
29}
30string(4) "Test"
31