1--TEST--
2Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
3--EXTENSIONS--
4phar
5--SKIPIF--
6<?php if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
7?>
8--INI--
9phar.readonly=0
10--FILE--
11<?php
12Phar::interceptFileFuncs();
13$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
14$fname2 = __DIR__ . '/' . 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--CLEAN--
29<?php
30@unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
31unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.php');
32?>
33--EXPECTF--
34Warning: readfile(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: fopen(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: 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
39
40Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
41bool(false)
42bool(false)
43bool(false)
44bool(false)
45bool(false)
46
47Warning: opendir(foo/hi): %s (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
48
49Warning: opendir(foo/hi): Failed to open directory: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
50