filegroup_variation3.phpt 2.2 KB

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