Return to popen_pclose_error-sunos.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test popen() and pclose function: error conditions 3: --SKIPIF-- 4: <?php 5: if( 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__); 19: echo "*** Testing for error conditions ***\n"; 20: var_dump( popen() ); // Zero Arguments 21: var_dump( popen("abc.txt") ); // Single Argument 22: var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument 23: var_dump( pclose() ); 24: $file_handle = fopen($file_path."/popen.tmp", "w"); 25: var_dump( pclose($file_handle, $file_handle) ); 26: fclose($file_handle); 27: var_dump( pclose(1) ); 28: echo "\n--- Done ---"; 29: ?> 30: --CLEAN-- 31: <?php 32: $file_path = dirname(__FILE__); 33: unlink($file_path."/popen.tmp"); 34: ?> 35: --EXPECTF-- 36: *** Testing for error conditions *** 37: 38: Warning: Wrong parameter count for popen() in %s on line %d 39: NULL 40: 41: Warning: Wrong parameter count for popen() in %s on line %d 42: NULL 43: sh: abc.txt: not found 44: resource(%d) of type (stream) 45: 46: Warning: Wrong parameter count for pclose() in %s on line %d 47: NULL 48: 49: Warning: Wrong parameter count for pclose() in %s on line %d 50: NULL 51: 52: Warning: pclose(): supplied argument is not a valid stream resource in %s on line %d 53: bool(false) 54: 55: --- Done ---