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