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 else 43 { 44 var_dump(file_get_contents($phar . $entry)); 45 } 46 } 47} 48 49dump('phar://hio', '/'); 50 51?> 52--CLEAN-- 53<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 54--EXPECT-- 55string(11) "phar://hio/" 56string(2) "/a" 57bool(false) 58string(1) "a" 59string(2) "/b" 60bool(true) 61string(12) "phar://hio/b" 62string(4) "/b/a" 63bool(false) 64string(1) "b" 65string(4) "/b/c" 66bool(true) 67string(14) "phar://hio/b/c" 68string(6) "/b/c/d" 69bool(false) 70string(1) "c" 71string(4) "/bad" 72bool(true) 73string(14) "phar://hio/bad" 74string(6) "/bad/c" 75bool(false) 76string(1) "d" 77