xref: /PHP-7.4/ext/phar/tests/030.phpt (revision 26dfce7f)
1--TEST--
2Phar::loadPhar ignoring alias
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7--FILE--
8<?php
9$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
10$pname = 'phar://' . $fname;
11$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
12
13$files = array();
14$files['a.php']   = '<?php echo "This is a\n"; include \''.$pname.'/b.php\'; ?>';
15$files['b.php']   = '<?php echo "This is b\n"; include \''.$pname.'/b/c.php\'; ?>';
16$files['b/c.php'] = '<?php echo "This is b/c\n"; include \''.$pname.'/b/d.php\'; ?>';
17$files['b/d.php'] = '<?php echo "This is b/d\n"; include \''.$pname.'/e.php\'; ?>';
18$files['e.php']   = '<?php echo "This is e\n"; ?>';
19$files['.phar/test'] = '<?php bad boy ?>';
20
21include 'files/phar_test.inc';
22
23Phar::loadPhar($fname);
24
25require $pname . '/a.php';
26
27$p = new Phar($fname);
28var_dump(isset($p['.phar/test']));
29try {
30$p['.phar/test'];
31} catch (Exception $e) {
32echo $e->getMessage(),"\n";
33}
34?>
35===DONE===
36--CLEAN--
37<?php
38unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
39?>
40--EXPECT--
41This is a
42This is b
43This is b/c
44This is b/d
45This is e
46bool(false)
47Cannot directly get any files or directories in magic ".phar" directory
48===DONE===
49