1--TEST--
2Phar: 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");
5if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
6?>
7--INI--
8phar.readonly=0
9--FILE--
10<?php
11Phar::interceptFileFuncs();
12$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
13$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
14$pname = 'phar://' . $fname;
15file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
16file_put_contents($pname . '/foo/hi', '<?php
17include "' . addslashes($fname2) . '";
18readfile("foo/hi");
19fopen("foo/hi", "r");
20echo file_get_contents("foo/hi");
21var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
22opendir("foo/hi");
23?>
24');
25include $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--
32Warning: 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
34Warning: 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
36Warning: 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
38Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
39bool(false)
40bool(false)
41bool(false)
42bool(false)
43bool(false)
44
45Warning: 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
47Warning: 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===
49