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