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