mirror of
https://github.com/php/php-src.git
synced 2024-10-21 00:12:34 +00:00
37c684ab3d
eliminating phar's interception of zend_compile in favor of a new to-be-added hook in PHP 5.3+, allow "include 'phar:///path/to/my.phar';" to work as equivalent to php /path/to/my.phar this slight change in scripting still allows inclusion and execution of phar stub, but removes the need to check and modify path in zend_compile, which allows us to play much nicer with external tools like debuggers/opcode caches
39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
--TEST--
|
|
Phar: include/fopen magic zip-based
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
|
--INI--
|
|
phar.require_hash=0
|
|
phar.readonly=0
|
|
--FILE--
|
|
<?php
|
|
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php';
|
|
$pname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php';
|
|
$p = new Phar($fname);
|
|
var_dump($p->isFileFormat(Phar::ZIP));
|
|
$p['a'] = '<?php include "b/c.php";' . "\n";
|
|
$p['b/c.php'] = '<?php echo "in b\n";$a = fopen("a", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";';
|
|
$p['d'] = "in d\n";
|
|
$p->setStub('<?php
|
|
var_dump(__FILE__);
|
|
var_dump(substr(__FILE__, 0, 4) != "phar");
|
|
set_include_path("phar://" . __FILE__);
|
|
include "phar://" . __FILE__ . "/a";
|
|
__HALT_COMPILER();');
|
|
include $pname;
|
|
?>
|
|
===DONE===
|
|
--CLEAN--
|
|
<?php
|
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php');
|
|
__HALT_COMPILER();
|
|
?>
|
|
--EXPECTF--
|
|
bool(true)
|
|
string(%d) "%sphar_magic.phar.zip.php"
|
|
bool(true)
|
|
in b
|
|
<?php include "b/c.php";
|
|
in d
|
|
===DONE===
|