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