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