xref: /PHP-8.1/ext/phar/tests/030.phpt (revision 74859783)
1--TEST--
2Phar::loadPhar ignoring alias
3--EXTENSIONS--
4phar
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--CLEAN--
36<?php
37unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
38?>
39--EXPECT--
40This is a
41This is b
42This is b/c
43This is b/d
44This is e
45bool(false)
46Cannot directly get any files or directories in magic ".phar" directory
47