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