1--TEST-- 2Test popen() and pclose function: error conditions 3--SKIPIF-- 4<?php 5if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') 6 die("skip Not Valid for Sun Solaris"); 7?> 8--FILE-- 9<?php 10/* 11 * Prototype: resource popen ( string command, string mode ) 12 * Description: Opens process file pointer. 13 14 * Prototype: int pclose ( resource handle ); 15 * Description: Closes process file pointer. 16 */ 17$file_path = __DIR__; 18echo "*** Testing for error conditions ***\n"; 19var_dump( popen() ); // Zero Arguments 20var_dump( popen("abc.txt") ); // Single Argument 21var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument 22var_dump( pclose() ); 23$file_handle = fopen($file_path."/popen.tmp", "w"); 24var_dump( pclose($file_handle, $file_handle) ); 25fclose($file_handle); 26var_dump( pclose(1) ); 27echo "\n--- Done ---"; 28?> 29--CLEAN-- 30<?php 31$file_path = __DIR__; 32unlink($file_path."/popen.tmp"); 33?> 34--EXPECTF-- 35*** Testing for error conditions *** 36 37Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d 38NULL 39 40Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d 41NULL 42 43Warning: popen(abc.txt,rw): %s on line %d 44bool(false) 45 46Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d 47bool(false) 48 49Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d 50bool(false) 51 52Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d 53bool(false) 54 55--- Done --- 56