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 7if (defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip"); 8?> 9--INI-- 10phar.readonly=0 11--FILE-- 12<?php 13Phar::interceptFileFuncs(); 14$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php'; 15$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.2.php'; 16$pname = 'phar://' . $fname; 17file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");'); 18file_put_contents($pname . '/foo/hi', '<?php 19include "' . addslashes($fname2) . '"; 20readfile("foo/hi"); 21fopen("foo/hi", "r"); 22echo file_get_contents("foo/hi"); 23var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi")); 24opendir("foo/hi"); 25?> 26'); 27include $pname . '/foo/hi'; 28?> 29--CLEAN-- 30<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 31<?php unlink(__DIR__ . '/' . 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 directory: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d 47