xref: /PHP-5.3/ext/phar/tests/phar_magic.phpt (revision 228c2886)
1--TEST--
2Phar: include/fopen magic
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8detect_unicode=0
9--FILE--
10<?php
11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
12$p = new Phar($fname);
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 dirname(__FILE__) . "/../d";';
15$p['d'] = "in d\n";
16$p->setStub('<?php
17set_include_path("phar://" . __FILE__);
18if (version_compare(PHP_VERSION, "5.3", "<")) {
19Phar::interceptFileFuncs();
20}
21include "phar://" . __FILE__ . "/a";
22__HALT_COMPILER();');
23include $fname;
24?>
25===DONE===
26--CLEAN--
27<?php
28unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
29__HALT_COMPILER();
30?>
31--EXPECTF--
32in b
33<?php include "b/c.php";
34in d
35===DONE===
36