mirror of
https://github.com/php/php-src.git
synced 2024-10-21 00:12:34 +00:00
de5aaaa74c
which then allows easy creation of tar/zip-based phar archives with a simple rename even when phar.readonly=1. Plug the hole very tightly, allowing read access to files, and also excluding them from opendir() output
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
--TEST--
|
|
Phar: test broken app
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
|
<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
|
|
--INI--
|
|
phar.readonly=0
|
|
--FILE--
|
|
<?php
|
|
|
|
$file = "zfapp";
|
|
$orig_file = dirname(__FILE__) . "/files/$file.tgz";
|
|
$tgz_file = dirname(__FILE__) . "/$file.tgz";
|
|
$phar_file = dirname(__FILE__) . "/$file.phar.tar.gz";
|
|
copy($orig_file, $tgz_file);
|
|
|
|
$phar = new PharData($tgz_file);
|
|
$phar = $phar->convertToExecutable();
|
|
|
|
$phar = new Phar($phar_file);
|
|
$phar->startBuffering();
|
|
$phar->setStub("<?php
|
|
Phar::interceptFileFuncs();
|
|
Phar::webPhar('$file.phar', 'html/index.php');
|
|
echo 'BlogApp is intended to be executed from a web browser\n';
|
|
exit -1;
|
|
__HALT_COMPILER();
|
|
");
|
|
$phar->stopBuffering();
|
|
|
|
foreach(new RecursiveIteratorIterator($phar) as $path) {
|
|
echo str_replace('\\', '/', $path->getPathName()) . "\n";
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
--CLEAN--
|
|
<?php
|
|
unlink(dirname(__FILE__) . '/zfapp.tgz');
|
|
unlink(dirname(__FILE__) . '/zfapp.phar.tar.gz');
|
|
?>
|
|
--EXPECTF--
|
|
phar://%szfapp.phar.tar.gz/application/default/controllers/ErrorController.php
|
|
phar://%szfapp.phar.tar.gz/application/default/controllers/IndexController.php
|
|
phar://%szfapp.phar.tar.gz/application/default/views/scripts/error/error.phtml
|
|
phar://%szfapp.phar.tar.gz/application/default/views/scripts/index/index.phtml
|
|
phar://%szfapp.phar.tar.gz/html/.htaccess
|
|
phar://%szfapp.phar.tar.gz/html/index.php
|
|
===DONE===
|