Annotation of embedaddon/php/ext/phar/tests/phar_gobyebye-win32.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 if (!extension_loaded("phar")) die("skip");
5: if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
6: ?>
7: --INI--
8: phar.readonly=0
9: --FILE--
10: <?php
11: Phar::interceptFileFuncs();
12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
13: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
14: $pname = 'phar://' . $fname;
15: file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
16: file_put_contents($pname . '/foo/hi', '<?php
17: include "' . addslashes($fname2) . '";
18: readfile("foo/hi");
19: fopen("foo/hi", "r");
20: echo file_get_contents("foo/hi");
21: var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
22: opendir("foo/hi");
23: ?>
24: ');
25: include $pname . '/foo/hi';
26: ?>
27: ===DONE===
28: --CLEAN--
29: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
30: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
31: --EXPECTF--
32: Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
33:
34: Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
35:
36: Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
37:
38: Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
39: bool(false)
40: bool(false)
41: bool(false)
42: bool(false)
43: bool(false)
44:
45: Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
46:
47: Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
48: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>