xref: /PHP-8.1/ext/phar/tests/phar_magic.phpt (revision 74859783)
1--TEST--
2Phar: include/fopen magic
3--EXTENSIONS--
4phar
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
11$p = new Phar($fname);
12$p['a'] = '<?php include "b/c.php";' . "\n";
13$p['b/c.php'] = '<?php echo "in b\n";$a = fopen("a", "r", true);echo stream_get_contents($a);fclose($a);include __DIR__ . "/../d";';
14$p['d'] = "in d\n";
15$p->setStub('<?php
16set_include_path("phar://" . __FILE__);
17include "phar://" . __FILE__ . "/a";
18__HALT_COMPILER();');
19include $fname;
20?>
21--CLEAN--
22<?php
23unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
24__HALT_COMPILER();
25?>
26--EXPECT--
27in b
28<?php include "b/c.php";
29in d
30