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