xref: /PHP-5.3/ext/phar/tests/019b.phpt (revision 610c7fbe)
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
10detect_unicode=0
11--FILE--
12<?php
13$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
14$pname = 'phar://' . $fname;
15$file = "<?php
16Phar::mapPhar('hio');
17__HALT_COMPILER(); ?>";
18
19$files = array();
20$files['a'] = 'a';
21$files['b/a'] = 'b';
22$files['b/c/d'] = 'c';
23$files['bad/c'] = 'd';
24include 'files/phar_test.inc';
25include $fname;
26
27function dump($phar, $base)
28{
29	var_dump($phar . $base);
30	$dir = opendir($phar . $base);
31	if ($base == '/')
32	{
33		$base = '';
34	}
35	while (false !== ($entry = readdir($dir))) {
36		$entry = $base . '/' . $entry;
37		var_dump($entry);
38		var_dump(is_dir($phar . $entry));
39		if (is_dir($phar . $entry))
40		{
41			dump($phar, $entry);
42		}
43	}
44}
45
46dump('phar://hio', '/');
47
48?>
49--CLEAN--
50<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
51--EXPECT--
52string(11) "phar://hio/"
53string(2) "/a"
54bool(false)
55string(2) "/b"
56bool(true)
57string(12) "phar://hio/b"
58string(4) "/b/a"
59bool(false)
60string(4) "/b/c"
61bool(true)
62string(14) "phar://hio/b/c"
63string(6) "/b/c/d"
64bool(false)
65string(4) "/bad"
66bool(true)
67string(14) "phar://hio/bad"
68string(6) "/bad/c"
69bool(false)
70