xref: /php-src/ext/phar/tests/readfile.phpt (revision 74859783)
1--TEST--
2Phar: test readfile() interception
3--EXTENSIONS--
4phar
5--INI--
6phar.require_hash=1
7phar.readonly=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
11$a = new Phar($fname);
12$a['index.php'] = '<?php
13readfile("dir/file1.txt");
14readfile("file1.txt", true);
15?>';
16$a['dir/file1.txt'] = 'hi';
17$a['dir/file2.txt'] = 'hi2';
18$a['dir/file3.txt'] = 'hi3';
19$a->setStub('<?php
20Phar::interceptFileFuncs();
21set_include_path("phar://" . __FILE__ . "/dir" . PATH_SEPARATOR . "phar://" . __FILE__);
22include "index.php";
23__HALT_COMPILER();');
24include $fname;
25?>
26===DONE===
27--CLEAN--
28<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
29--EXPECT--
30hihi===DONE===
31