xref: /PHP-5.6/ext/phar/tests/readfile.phpt (revision 228c2886)
1--TEST--
2Phar: test readfile() interception
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip");?>
5--INI--
6phar.require_hash=1
7phar.readonly=0
8--FILE--
9<?php
10$fname = dirname(__FILE__) . '/' . 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(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
29--EXPECT--
30hihi===DONE===