Annotation of embedaddon/php/ext/phar/tests/019cU.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: opendir test, recurse into
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("phar")) die("skip");
6: if (version_compare(PHP_VERSION, "6.0", "<")) die("skip Unicode support required");
7: ?>
8: --INI--
9: phar.require_hash=0
10: --FILE--
11: <?php
12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
13: $pname = 'phar://' . $fname;
14: $file = b"<?php
15: Phar::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';
23: include 'files/phar_test.inc';
24: include $fname;
25:
26: function 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: else
43: {
44: var_dump(file_get_contents($phar . $entry));
45: }
46: }
47: }
48:
49: dump('phar://hio', '/');
50:
51: ?>
52: --CLEAN--
53: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
54: --EXPECT--
55: unicode(11) "phar://hio/"
56: unicode(2) "/a"
57: bool(false)
58: string(1) "a"
59: unicode(2) "/b"
60: bool(true)
61: unicode(12) "phar://hio/b"
62: unicode(4) "/b/a"
63: bool(false)
64: string(1) "b"
65: unicode(4) "/b/c"
66: bool(true)
67: unicode(14) "phar://hio/b/c"
68: unicode(6) "/b/c/d"
69: bool(false)
70: string(1) "c"
71: unicode(4) "/bad"
72: bool(true)
73: unicode(14) "phar://hio/bad"
74: unicode(6) "/bad/c"
75: bool(false)
76: string(1) "d"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>