xref: /PHP-7.0/ext/phar/tests/019b.phpt (revision e3de409e)
1--TEST--
2Phar: opendir test, recurse into
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (version_compare(PHP_VERSION, "6.0", "==")) die("skip pre-unicode version of PHP required");
7?>
8--INI--
9phar.require_hash=0
10--FILE--
11<?php
12$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
13$pname = 'phar://' . $fname;
14$file = "<?php
15Phar::mapPhar('hio');
16__HALT_COMPILER(); ?>";
17
18$files = array();
19$files['a'] = 'a';
20$files['b/a'] = 'b';
21$files['b/c/d'] = 'c';
22$files['bad/c'] = 'd';
23include 'files/phar_test.inc';
24include $fname;
25
26function dump($phar, $base)
27{
28	var_dump($phar . $base);
29	$dir = opendir($phar . $base);
30	if ($base == '/')
31	{
32		$base = '';
33	}
34	while (false !== ($entry = readdir($dir))) {
35		$entry = $base . '/' . $entry;
36		var_dump($entry);
37		var_dump(is_dir($phar . $entry));
38		if (is_dir($phar . $entry))
39		{
40			dump($phar, $entry);
41		}
42	}
43}
44
45dump('phar://hio', '/');
46
47?>
48--CLEAN--
49<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
50--EXPECT--
51string(11) "phar://hio/"
52string(2) "/a"
53bool(false)
54string(2) "/b"
55bool(true)
56string(12) "phar://hio/b"
57string(4) "/b/a"
58bool(false)
59string(4) "/b/c"
60bool(true)
61string(14) "phar://hio/b/c"
62string(6) "/b/c/d"
63bool(false)
64string(4) "/bad"
65bool(true)
66string(14) "phar://hio/bad"
67string(6) "/bad/c"
68bool(false)
69