Return to popen_pclose_error.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) == 'WIN' || strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') 6: die("skip Not Valid for Windows & 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: popen() expects exactly 2 parameters, 0 given in %s on line %d 39: NULL 40: 41: Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d 42: NULL 43: 44: Warning: popen(abc.txt,rw): %s on line %d 45: bool(false) 46: 47: Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d 48: bool(false) 49: 50: Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d 51: bool(false) 52: 53: Warning: pclose() expects parameter 1 to be resource, integer given in %s on line %d 54: bool(false) 55: 56: --- Done ---