1--TEST--
2proc_open() with invalid pipes
3--FILE--
4<?php
5
6include dirname(__FILE__) . "/proc_open_pipes.inc";
7
8for ($i = 3; $i<= 5; $i++) {
9	$spec[$i] = array('pipe', 'w');
10}
11
12$php = getenv("TEST_PHP_EXECUTABLE");
13$callee = create_sleep_script();
14
15$spec[$i] = array('pi');
16proc_open("$php -n $callee", $spec, $pipes);
17
18$spec[$i] = 1;
19proc_open("$php -n $callee", $spec, $pipes);
20
21$spec[$i] = array('pipe', "test");
22proc_open("$php -n $callee", $spec, $pipes);
23var_dump($pipes);
24
25$spec[$i] = array('file', "test", "z");
26proc_open("$php -n $callee", $spec, $pipes);
27var_dump($pipes);
28
29echo "END\n";
30?>
31--CLEAN--
32<?php
33include dirname(__FILE__) . "/proc_open_pipes.inc";
34
35unlink_sleep_script();
36
37?>
38--EXPECTF--
39Warning: proc_open(): pi is not a valid descriptor spec/mode in %s on line %d
40
41Warning: proc_open(): Descriptor item must be either an array or a File-Handle in %s on line %d
42array(4) {
43  [3]=>
44  resource(%d) of type (Unknown)
45  [4]=>
46  resource(%d) of type (Unknown)
47  [5]=>
48  resource(%d) of type (Unknown)
49  [6]=>
50  resource(%d) of type (Unknown)
51}
52
53Warning: proc_open(test): failed to open stream: %s in %s on line %d
54array(4) {
55  [3]=>
56  resource(%d) of type (Unknown)
57  [4]=>
58  resource(%d) of type (Unknown)
59  [5]=>
60  resource(%d) of type (Unknown)
61  [6]=>
62  resource(%d) of type (Unknown)
63}
64END
65