2005-12-11 07:25:30 +00:00
|
|
|
--TEST--
|
2006-01-01 23:05:42 +00:00
|
|
|
Phar: opendir test, root directory
|
2005-12-11 07:25:30 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php if (!extension_loaded("phar")) print "skip"; ?>
|
2007-01-08 23:03:41 +00:00
|
|
|
--INI--
|
|
|
|
phar.require_hash=0
|
2005-12-11 07:25:30 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
$file = "<?php
|
2006-01-11 00:50:33 +00:00
|
|
|
Phar::mapPhar('hio');
|
2005-12-11 07:25:30 +00:00
|
|
|
__HALT_COMPILER(); ?>";
|
2006-01-11 00:50:33 +00:00
|
|
|
|
|
|
|
$files = array();
|
|
|
|
$files['a'] = 'a';
|
|
|
|
$files['b/a'] = 'b';
|
2005-12-11 07:25:30 +00:00
|
|
|
$manifest = '';
|
2006-01-11 00:50:33 +00:00
|
|
|
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 .= chr(0) . chr(4) . chr(0); // 'a' gzdeflated
|
|
|
|
}
|
|
|
|
|
2006-01-04 16:43:42 +00:00
|
|
|
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
|
|
|
|
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
2005-12-11 07:25:30 +00:00
|
|
|
$dir = opendir('phar://hio/');
|
|
|
|
while (false !== ($a = readdir($dir))) {
|
|
|
|
var_dump($a);
|
|
|
|
var_dump(is_dir('phar://hio/' . $a));
|
|
|
|
}
|
|
|
|
?>
|
2006-01-04 16:43:42 +00:00
|
|
|
--CLEAN--
|
|
|
|
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
2005-12-11 07:25:30 +00:00
|
|
|
--EXPECT--
|
|
|
|
string(1) "a"
|
|
|
|
bool(false)
|
|
|
|
string(1) "b"
|
|
|
|
bool(true)
|