1--TEST--
2proc_open() with invalid pipes
3--FILE--
4<?php
5
6for ($i = 3; $i<= 5; $i++) {
7    $spec[$i] = array('pipe', 'w');
8}
9
10$php = getenv("TEST_PHP_EXECUTABLE");
11$callee = __DIR__ . "/proc_open_pipes_sleep.inc";
12
13$spec[$i] = array('pi');
14proc_open("$php -n $callee", $spec, $pipes);
15
16$spec[$i] = 1;
17try {
18    proc_open("$php -n $callee", $spec, $pipes);
19} catch (ValueError $exception) {
20    echo $exception->getMessage() . "\n";
21}
22
23$spec[$i] = array('pipe', "test");
24proc_open("$php -n $callee", $spec, $pipes);
25var_dump($pipes);
26
27$spec[$i] = array('file', "test", "z");
28proc_open("$php -n $callee", $spec, $pipes);
29var_dump($pipes);
30
31echo "END\n";
32?>
33--EXPECTF--
34Warning: proc_open(): pi is not a valid descriptor spec/mode in %s on line %d
35proc_open(): Argument #2 ($descriptor_spec) must only contain arrays and streams
36array(4) {
37  [3]=>
38  resource(%d) of type (Unknown)
39  [4]=>
40  resource(%d) of type (Unknown)
41  [5]=>
42  resource(%d) of type (Unknown)
43  [6]=>
44  resource(%d) of type (Unknown)
45}
46
47Warning: proc_open(test): Failed to open stream: %s in %s on line %d
48array(4) {
49  [3]=>
50  resource(%d) of type (Unknown)
51  [4]=>
52  resource(%d) of type (Unknown)
53  [5]=>
54  resource(%d) of type (Unknown)
55  [6]=>
56  resource(%d) of type (Unknown)
57}
58END
59