mirror of
https://github.com/php/php-src.git
synced 2024-10-01 06:46:08 +00:00
36efc2a907
major improvement of zip/tar-based phar stub execution, now __FILE__ says it is the phar, and not phar/.phar/stub.php, so that the same stub can be used for phar or tar/zip-based phars ridiculous speedup of rename() within a phar (something like 1000%) last of the tar-based phar fixes new tests for tar-based phars, fix existing tests to use new format of __FILE__
43 lines
993 B
PHP
43 lines
993 B
PHP
--TEST--
|
|
Phar::setAlias() tar-based
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
|
--INI--
|
|
phar.require_hash=0
|
|
phar.readonly=0
|
|
--FILE--
|
|
<?php
|
|
include dirname(__FILE__) . '/tarmaker.php.inc';
|
|
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
|
$pname = 'phar://' . $fname;
|
|
$a = new tarmaker($fname, 'none');
|
|
$a->init();
|
|
$a->addFile('.phar/stub.php', '<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
|
|
|
|
$files = array();
|
|
$files['a'] = 'a';
|
|
$files['b'] = 'b';
|
|
$files['c'] = 'c';
|
|
$files['.phar/alias.txt'] = 'hio';
|
|
foreach ($files as $n => $file) {
|
|
$a->addFile($n, $file);
|
|
}
|
|
$a->close();
|
|
|
|
$phar = new Phar($fname);
|
|
echo $phar->getAlias() . "\n";
|
|
$phar->setAlias('test');
|
|
echo $phar->getAlias() . "\n";
|
|
?>
|
|
===DONE===
|
|
--CLEAN--
|
|
<?php
|
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
|
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.php');
|
|
__HALT_COMPILER();
|
|
?>
|
|
--EXPECT--
|
|
hio
|
|
test
|
|
===DONE===
|