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
9--FILE--
10<?php
11/*
12 * Prototype: resource popen ( string command, string mode )
13 * Description: Opens process file pointer.
14
15 * Prototype: int pclose ( resource handle );
16 * Description: Closes process file pointer.
17 */
18$file_path = dirname(__FILE__);
19echo "*** Testing for error conditions ***\n";
20var_dump( popen() );  // Zero Arguments
21var_dump( popen("abc.txt") );   // Single Argument
22var_dump( popen("abc.txt", "rw") );   // Invalid mode Argument
23var_dump( pclose() );
24$file_handle = fopen($file_path."/popen.tmp", "w");
25var_dump( pclose($file_handle, $file_handle) );
26fclose($file_handle);
27var_dump( pclose(1) );
28echo "\n--- Done ---";
29?>
30--CLEAN--
31<?php
32$file_path = dirname(__FILE__);
33unlink($file_path."/popen.tmp");
34?>
35--EXPECTF--
36*** Testing for error conditions ***
37
38Warning: Wrong parameter count for popen() in %s on line %d
39NULL
40
41Warning: Wrong parameter count for popen() in %s on line %d
42NULL
43sh: abc.txt: not found
44resource(%d) of type (stream)
45
46Warning: Wrong parameter count for pclose() in %s on line %d
47NULL
48
49Warning: Wrong parameter count for pclose() in %s on line %d
50NULL
51
52Warning: pclose(): supplied argument is not a valid stream resource in %s on line %d
53bool(false)
54
55--- Done ---
56