--TEST-- Phar: test that refcounting avoids problems with deleting a file --SKIPIF-- --INI-- phar.readonly=0 phar.require_hash=0 --FILE-- "; $files = array(); $files['a.php'] = ''; $files['b.php'] = ''; $files['b/c.php'] = ''; include 'phar_test.inc'; $fp = fopen($pname . '/b/c.php', 'wb'); fwrite($fp, "extra"); fclose($fp); echo "===CLOSE===\n"; $p = new Phar($fname); $b = fopen($pname . '/b/c.php', 'rb'); $a = $p['b/c.php']; var_dump($a); var_dump(fread($b, 20)); rewind($b); echo "===UNLINK===\n"; unlink($pname . '/b/c.php'); var_dump($a); var_dump(fread($b, 20)); include $pname . '/b/c.php'; ?> ===DONE=== --CLEAN-- --EXPECTF-- ===CLOSE=== object(PharFileInfo)#%d (2) { ["pathName":"SplFileInfo":private]=> string(%d) "phar://%srefcount1.phar.php/b" ["fileName":"SplFileInfo":private]=> string(%d) "phar://%srefcount1.phar.php/b/c.php" } string(5) "extra" ===UNLINK=== Warning: unlink(): phar error: "b/c.php" in phar "%srefcount1.phar.php", has open file pointers, cannot unlink in %srefcount1.php on line %d object(PharFileInfo)#%d (2) { ["pathName":"SplFileInfo":private]=> string(%d) "phar://%srefcount1.phar.php/b" ["fileName":"SplFileInfo":private]=> string(%s) "phar://%srefcount1.phar.php/b/c.php" } string(5) "extra" extra ===DONE===