Return to fileowner_variation2.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test fileowner() function: usage variations - invalid filenames 3: --CREDITS-- 4: Dave Kelsey <d_kelsey@uk.ibm.com> 5: --FILE-- 6: <?php 7: /* Prototype: int fileowner ( string $filename ) 8: * Description: Returns the user ID of the owner of the file, or 9: * FALSE in case of an error. 10: */ 11: 12: /* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */ 13: 14: $file_path = dirname(__FILE__); 15: $file_handle = fopen($file_path."/fileowner_variation2.tmp", "w"); 16: 17: echo "*** Testing Invalid file types ***\n"; 18: $filenames = array( 19: /* Invalid filenames */ 20: -2.34555, 21: " ", 22: "", 23: TRUE, 24: FALSE, 25: NULL, 26: $file_handle, 27: 28: /* scalars */ 29: 1234, 30: 0 31: ); 32: 33: /* loop through to test each element the above array */ 34: foreach( $filenames as $filename ) { 35: var_dump( fileowner($filename) ); 36: clearstatcache(); 37: } 38: fclose($file_handle); 39: 40: echo "\n*** Done ***"; 41: ?> 42: --CLEAN-- 43: <?php 44: $file_path = dirname(__FILE__); 45: unlink($file_path."/fileowner_variation2.tmp"); 46: ?> 47: --EXPECTF-- 48: *** Testing Invalid file types *** 49: 50: Warning: fileowner(): stat failed for -2.34555 in %s on line %d 51: bool(false) 52: 53: Warning: fileowner(): stat failed for in %s on line %d 54: bool(false) 55: bool(false) 56: 57: Warning: fileowner(): stat failed for 1 in %s on line %d 58: bool(false) 59: bool(false) 60: bool(false) 61: 62: Warning: fileowner() expects parameter 1 to be string, resource given in %s on line %d 63: NULL 64: 65: Warning: fileowner(): stat failed for 1234 in %s on line %d 66: bool(false) 67: 68: Warning: fileowner(): stat failed for 0 in %s on line %d 69: bool(false) 70: 71: *** Done *** 72: