--TEST-- Phar: phar:// opendir --SKIPIF-- --FILE-- "; $files = array(); $files['a.php'] = ''; $files['b.php'] = ''; $files['b/c.php'] = ''; $files['b/d.php'] = ''; $files['e.php'] = ''; $manifest = ''; foreach($files as $name => $cont) { $len = strlen($cont); $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00); } $alias = 'hio'; $manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest; $file .= pack('V', strlen($manifest)) . $manifest; foreach($files as $cont) { $file .= $cont; } file_put_contents($fname, $file); function dump($phar, $base) { var_dump(str_replace(dirname(__FILE__), '*', $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($pname, '/'); ?> ===DONE=== --CLEAN-- --EXPECTF-- string(%d) "phar://*/027.phar.php/" string(6) "/a.php" bool(false) string(2) "/b" bool(true) string(%d) "phar://*/027.phar.php/b" string(8) "/b/c.php" bool(false) string(8) "/b/d.php" bool(false) string(6) "/b.php" bool(false) string(6) "/e.php" bool(false) ===DONE===