bug24482.phpt 816 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Bug #24482 (GLOB_ONLYDIR not working)
  3. --SKIPIF--
  4. <?php
  5. if (!function_exists("glob")) {
  6. die('skip glob() not available');
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. // run this test in ext/standard/tests (see bug #64714)
  12. chdir(__DIR__); // ensure in ext/standard/tests/file
  13. chdir('..'); // move up to ext/standard/tests
  14. $globdirs = glob("*", GLOB_ONLYDIR);
  15. $dirs = array();
  16. $dh = opendir(".");
  17. while (is_string($file = readdir($dh))) {
  18. if ($file[0] === ".") continue;
  19. if (!is_dir($file)) continue;
  20. $dirs[] = $file;
  21. }
  22. closedir($dh);
  23. if (count($dirs) != count($globdirs)) {
  24. echo "Directory count mismatch\n";
  25. echo "glob found:\n";
  26. sort($globdirs);
  27. var_dump($globdirs);
  28. echo "opendir/readdir/isdir found:\n";
  29. sort($dirs);
  30. var_dump($dirs);
  31. } else {
  32. echo "OK\n";
  33. }
  34. ?>
  35. --EXPECT--
  36. OK