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 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php'; 13$fname2 = __DIR__ . '/' . 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--CLEAN-- 28<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 29<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?> 30--EXPECTF-- 31Warning: readfile(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d 32 33Warning: fopen(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d 34 35Warning: 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 36 37Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d 38bool(false) 39bool(false) 40bool(false) 41bool(false) 42bool(false) 43 44Warning: opendir(foo/hi): %s (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d 45 46Warning: opendir(foo/hi): Failed to open directory: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d 47