1--TEST--
2Test popen() and pclose function: error conditions
3--SKIPIF--
4<?php
5if( substr(PHP_OS, 0, 3) != 'Sun')
6  die("skip Only valid for Sun Solaris");
7?>
8--FILE--
9<?php
10
11$file_path = __DIR__;
12echo "*** Testing for error conditions ***\n";
13var_dump( popen() );  // Zero Arguments
14var_dump( popen("abc.txt") );   // Single Argument
15var_dump( popen("abc.txt", "rw") );   // Invalid mode Argument
16var_dump( pclose() );
17$file_handle = fopen($file_path."/popen.tmp", "w");
18var_dump( pclose($file_handle, $file_handle) );
19fclose($file_handle);
20var_dump( pclose(1) );
21echo "\n--- Done ---";
22?>
23--CLEAN--
24<?php
25$file_path = __DIR__;
26unlink($file_path."/popen.tmp");
27?>
28--EXPECTF--
29*** Testing for error conditions ***
30
31Warning: Wrong parameter count for popen() in %s on line %d
32NULL
33
34Warning: Wrong parameter count for popen() in %s on line %d
35NULL
36sh: abc.txt: not found
37resource(%d) of type (stream)
38
39Warning: Wrong parameter count for pclose() in %s on line %d
40NULL
41
42Warning: Wrong parameter count for pclose() in %s on line %d
43NULL
44
45Warning: pclose(): supplied argument is not a valid stream resource in %s on line %d
46bool(false)
47
48--- Done ---
49