1--TEST-- 2Phar: opendir test, recurse into 3--SKIPIF-- 4<?php 5if (!extension_loaded("phar")) die("skip"); 6?> 7--INI-- 8phar.require_hash=0 9--FILE-- 10<?php 11$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php'; 12$pname = 'phar://' . $fname; 13$file = "<?php 14Phar::mapPhar('hio'); 15__HALT_COMPILER(); ?>"; 16 17$files = array(); 18$files['a'] = 'a'; 19$files['b/a'] = 'b'; 20$files['b/c/d'] = 'c'; 21$files['bad/c'] = 'd'; 22include 'files/phar_test.inc'; 23include $fname; 24 25function dump($phar, $base) 26{ 27 var_dump($phar . $base); 28 $dir = opendir($phar . $base); 29 if ($base == '/') 30 { 31 $base = ''; 32 } 33 while (false !== ($entry = readdir($dir))) { 34 $entry = $base . '/' . $entry; 35 var_dump($entry); 36 var_dump(is_dir($phar . $entry)); 37 if (is_dir($phar . $entry)) 38 { 39 dump($phar, $entry); 40 } 41 } 42} 43 44dump('phar://hio', '/'); 45 46?> 47--CLEAN-- 48<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 49--EXPECT-- 50string(11) "phar://hio/" 51string(2) "/a" 52bool(false) 53string(2) "/b" 54bool(true) 55string(12) "phar://hio/b" 56string(4) "/b/a" 57bool(false) 58string(4) "/b/c" 59bool(true) 60string(14) "phar://hio/b/c" 61string(6) "/b/c/d" 62bool(false) 63string(4) "/bad" 64bool(true) 65string(14) "phar://hio/bad" 66string(6) "/bad/c" 67bool(false) 68