xref: /PHP-5.4/ext/phar/tests/phar_gobyebye.phpt (revision 0c4915d5)
1--TEST--
2Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
3--SKIPIF--
4<?php
5if (defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip");
6if (!extension_loaded("phar")) die("skip");
7?>
8--INI--
9phar.readonly=0
10--FILE--
11<?php
12Phar::interceptFileFuncs();
13$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
14$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
15$pname = 'phar://' . $fname;
16file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
17file_put_contents($pname . '/foo/hi', '<?php
18include "' . addslashes($fname2) . '";
19readfile("foo/hi");
20fopen("foo/hi", "r");
21echo file_get_contents("foo/hi");
22var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
23opendir("foo/hi");
24?>
25');
26include $pname . '/foo/hi';
27?>
28===DONE===
29--CLEAN--
30<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
31<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
32--EXPECTF--
33Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
34
35Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
36
37Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
38
39Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
40bool(false)
41bool(false)
42bool(false)
43bool(false)
44bool(false)
45
46Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
47===DONE===
48