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