1--TEST-- 2Test filegroup() function: usage variations - diff. path notations 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7/* Prototype: int filegroup ( string $filename ) 8 * Description: Returns the group ID of the file, or FALSE in case of an error. 9 */ 10 11/* Passing file names with different notations, using slashes, wild-card chars */ 12 13$file_path = dirname(__FILE__); 14 15echo "*** Testing filegroup() with different notations of file names ***\n"; 16$dir_name = $file_path."/filegroup_variation3"; 17mkdir($dir_name); 18$file_handle = fopen($dir_name."/filegroup_variation3.tmp", "w"); 19fclose($file_handle); 20 21$files_arr = array( 22 "/filegroup_variation3/filegroup_variation3.tmp", 23 24 /* Testing a file trailing slash */ 25 "/filegroup_variation3/filegroup_variation3.tmp/", 26 27 /* Testing file with double slashes */ 28 "/filegroup_variation3//filegroup_variation3.tmp", 29 "//filegroup_variation3//filegroup_variation3.tmp", 30 "/filegroup_variation3/*.tmp", 31 "filegroup_variation3/filegroup*.tmp", 32 33 /* Testing Binary safe */ 34 "/filegroup_variation3/filegroup_variation3.tmp".chr(0), 35 "/filegroup_variation3/filegroup_variation3.tmp\0" 36); 37 38$count = 1; 39/* loop through to test each element in the above array */ 40foreach($files_arr as $file) { 41 echo "- Iteration $count -\n"; 42 var_dump( filegroup( $file_path."/".$file ) ); 43 clearstatcache(); 44 $count++; 45} 46 47echo "\n*** Done ***"; 48?> 49--CLEAN-- 50<?php 51$file_path = dirname(__FILE__); 52$dir_name = $file_path."/filegroup_variation3"; 53unlink($dir_name."/filegroup_variation3.tmp"); 54rmdir($dir_name); 55?> 56--EXPECTF-- 57*** Testing filegroup() with different notations of file names *** 58- Iteration 1 - 59int(%d) 60- Iteration 2 - 61 62Warning: filegroup(): stat failed for %s//filegroup_variation3/filegroup_variation3.tmp/ in %s on line %d 63bool(false) 64- Iteration 3 - 65int(%d) 66- Iteration 4 - 67int(%d) 68- Iteration 5 - 69 70Warning: filegroup(): stat failed for %s//filegroup_variation3/*.tmp in %s on line %d 71bool(false) 72- Iteration 6 - 73 74Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d 75bool(false) 76- Iteration 7 - 77 78Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d 79NULL 80- Iteration 8 - 81 82Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d 83NULL 84 85*** Done *** 86