From 32ab7543b1050f5060271801f040ac7239640b3f Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 3 Jan 2006 21:34:11 +0000 Subject: [PATCH] - Add new test --- ext/phar/tests/019b.phpt | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 ext/phar/tests/019b.phpt diff --git a/ext/phar/tests/019b.phpt b/ext/phar/tests/019b.phpt new file mode 100755 index 0000000000..218e519379 --- /dev/null +++ b/ext/phar/tests/019b.phpt @@ -0,0 +1,66 @@ +--TEST-- +Phar: opendir test, recurse into +--SKIPIF-- + +--FILE-- +"; +$manifest = ''; +$manifest .= pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9); +$manifest .= pack('V', 3) . 'b/a' . pack('VVVV', 1, time(), 0, 9); +$manifest .= pack('V', 5) . 'b/c/d' . pack('VVVV', 1, time(), 0, 9); +$manifest .= pack('V', 5) . 'bad/c' . pack('VVVV', 1, time(), 0, 9); +$file .= pack('VV', strlen($manifest) + 4, 4) . + $manifest . + pack('VV', crc32('a'), 1) . 'a' . + pack('VV', crc32('b'), 1) . 'b'; + pack('VV', crc32('c'), 1) . 'c'; + pack('VV', crc32('d'), 1) . 'd'; +file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); +include dirname(__FILE__) . '/008_phar.php'; + +function dump($phar, $base) +{ + var_dump($phar . $base); + $dir = opendir($phar . $base); + if ($base == '/') + { + $base = ''; + } + while (false !== ($entry = readdir($dir))) { + $entry = $base . '/' . $entry; + var_dump($entry); + var_dump(is_dir($phar . $entry)); + if (is_dir($phar . $entry)) + { + dump($phar, $entry); + } + } +} + +dump('phar://hio', '/'); + +?> +--EXPECT-- +string(11) "phar://hio/" +string(2) "/a" +bool(false) +string(2) "/b" +bool(true) +string(12) "phar://hio/b" +string(4) "/b/a" +bool(false) +string(4) "/b/c" +bool(true) +string(14) "phar://hio/b/c" +string(6) "/b/c/d" +bool(false) +string(4) "/bad" +bool(true) +string(14) "phar://hio/bad" +string(6) "/bad/c" +bool(false) -- 2.50.1