Annotation of embedaddon/php/ext/phar/tests/phar_gobyebye.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
3: --SKIPIF--
4: <?php
5: if (defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip");
6: if (!extension_loaded("phar")) die("skip");
7: ?>
8: --INI--
9: phar.readonly=0
10: --FILE--
11: <?php
12: Phar::interceptFileFuncs();
13: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
14: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
15: $pname = 'phar://' . $fname;
16: file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
17: file_put_contents($pname . '/foo/hi', '<?php
18: include "' . addslashes($fname2) . '";
19: readfile("foo/hi");
20: fopen("foo/hi", "r");
21: echo file_get_contents("foo/hi");
22: var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
23: opendir("foo/hi");
24: ?>
25: ');
26: include $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--
33: Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
34:
35: Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
36:
37: Warning: 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:
39: Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
40: bool(false)
41: bool(false)
42: bool(false)
43: bool(false)
44: bool(false)
45:
46: Warning: 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===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>