scandir_variation8-win32-mb.phpt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. --TEST--
  2. Test scandir() function : usage variations - different file names
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die("skip Valid only on Windows");
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /*
  12. * Pass a directory containing files with different types of names to test how scandir()
  13. * reads them
  14. */
  15. echo "*** Testing scandir() : usage variations ***\n";
  16. $dir_path = __DIR__ . "/私はガラスを食べられますscandir_variation8/";
  17. mkdir($dir_path);
  18. // heredoc string
  19. $heredoc = <<<EOT
  20. hd_file
  21. EOT;
  22. $inputs = array(
  23. // int data
  24. /*1*/ 0,
  25. 1,
  26. 12345,
  27. -2345,
  28. // float data
  29. /*5*/ 10.5,
  30. -10.5,
  31. 12.3456789000e10,
  32. 12.3456789000E-10,
  33. .5,
  34. // empty data
  35. /*10*/ "",
  36. array(),
  37. // string data
  38. /*12*/ "double_file",
  39. 'single_file',
  40. $heredoc,
  41. );
  42. $iterator = 1;
  43. foreach($inputs as $key => $input) {
  44. echo "\n-- Iteration $iterator --\n";
  45. $handle = "fp{$iterator}";
  46. var_dump( $$handle = @fopen($dir_path . "/私はガラスを食べられます$input.tmp", 'w') );
  47. fclose($$handle);
  48. $iterator++;
  49. };
  50. echo "\n-- Call to scandir() --\n";
  51. var_dump($content = scandir($dir_path));
  52. // remove all files in directory so can remove directory in CLEAN section
  53. foreach ($content as $file_name) {
  54. // suppress errors as won't be able to remove "." and ".." entries
  55. @unlink($dir_path . $file_name);
  56. }
  57. ?>
  58. --CLEAN--
  59. <?php
  60. $dir_path = __DIR__ . "/私はガラスを食べられますscandir_variation8";
  61. rmdir($dir_path);
  62. ?>
  63. --EXPECTF--
  64. *** Testing scandir() : usage variations ***
  65. -- Iteration 1 --
  66. resource(%d) of type (stream)
  67. -- Iteration 2 --
  68. resource(%d) of type (stream)
  69. -- Iteration 3 --
  70. resource(%d) of type (stream)
  71. -- Iteration 4 --
  72. resource(%d) of type (stream)
  73. -- Iteration 5 --
  74. resource(%d) of type (stream)
  75. -- Iteration 6 --
  76. resource(%d) of type (stream)
  77. -- Iteration 7 --
  78. resource(%d) of type (stream)
  79. -- Iteration 8 --
  80. resource(%d) of type (stream)
  81. -- Iteration 9 --
  82. resource(%d) of type (stream)
  83. -- Iteration 10 --
  84. resource(%d) of type (stream)
  85. -- Iteration 11 --
  86. resource(%d) of type (stream)
  87. -- Iteration 12 --
  88. resource(%d) of type (stream)
  89. -- Iteration 13 --
  90. resource(%d) of type (stream)
  91. -- Iteration 14 --
  92. resource(%d) of type (stream)
  93. -- Call to scandir() --
  94. array(16) {
  95. [0]=>
  96. string(1) "."
  97. [1]=>
  98. string(2) ".."
  99. [2]=>
  100. string(45) "私はガラスを食べられます-10.5.tmp"
  101. [3]=>
  102. string(45) "私はガラスを食べられます-2345.tmp"
  103. [4]=>
  104. string(40) "私はガラスを食べられます.tmp"
  105. [5]=>
  106. string(43) "私はガラスを食べられます0.5.tmp"
  107. [6]=>
  108. string(41) "私はガラスを食べられます0.tmp"
  109. [7]=>
  110. string(53) "私はガラスを食べられます1.23456789E-9.tmp"
  111. [8]=>
  112. string(41) "私はガラスを食べられます1.tmp"
  113. [9]=>
  114. string(44) "私はガラスを食べられます10.5.tmp"
  115. [10]=>
  116. string(45) "私はガラスを食べられます12345.tmp"
  117. [11]=>
  118. string(52) "私はガラスを食べられます123456789000.tmp"
  119. [12]=>
  120. string(45) "私はガラスを食べられますArray.tmp"
  121. [13]=>
  122. string(51) "私はガラスを食べられますdouble_file.tmp"
  123. [14]=>
  124. string(47) "私はガラスを食べられますhd_file.tmp"
  125. [15]=>
  126. string(51) "私はガラスを食べられますsingle_file.tmp"
  127. }