From 74fe7a1e20dba632d0e7b2c6d540eec3406277eb Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 6 Nov 2007 14:47:11 +0000 Subject: [PATCH] - fix tests --- ext/phar/tests/refcount1.phpt | 15 +++++++-- ext/phar/tests/refcount1_5_2.phpt | 54 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) create mode 100755 ext/phar/tests/refcount1_5_2.phpt diff --git a/ext/phar/tests/refcount1.phpt b/ext/phar/tests/refcount1.phpt index 3025fb2bde..2660704746 100644 --- a/ext/phar/tests/refcount1.phpt +++ b/ext/phar/tests/refcount1.phpt @@ -3,6 +3,7 @@ Phar: test that refcounting avoids problems with deleting a file --SKIPIF-- + --INI-- phar.readonly=0 phar.require_hash=0 @@ -40,13 +41,21 @@ include $pname . '/b/c.php'; --EXPECTF-- ===CLOSE=== -object(PharFileInfo)#%d (0) { +object(PharFileInfo)#%d (2) { + ["pathName":"SplFileInfo":private]=> + string(59) "phar://%srefcount1.phar.php/b" + ["fileName":"SplFileInfo":private]=> + string(65) "phar://%srefcount1.phar.php/b/c.php" } string(5) "extra" ===UNLINK=== -Warning: unlink(): phar error: "b/c.php" in phar "%sefcount1.phar.php", has open file pointers, cannot unlink in %sefcount1.php on line %d -object(PharFileInfo)#%d (0) { +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(59) "phar:///usr/src/PHP_5_3/ext/phar/tests/refcount1.phar.php/b" + ["fileName":"SplFileInfo":private]=> + string(65) "phar:///usr/src/PHP_5_3/ext/phar/tests/refcount1.phar.php/b/c.php" } string(5) "extra" extra diff --git a/ext/phar/tests/refcount1_5_2.phpt b/ext/phar/tests/refcount1_5_2.phpt new file mode 100755 index 0000000000..6f58cdb625 --- /dev/null +++ b/ext/phar/tests/refcount1_5_2.phpt @@ -0,0 +1,54 @@ +--TEST-- +Phar: test that refcounting avoids problems with deleting a file +--SKIPIF-- + + +")) die("skip requires 5.2 or earlier"); ?> +--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 (0) { +} +string(5) "extra" +===UNLINK=== + +Warning: unlink(): phar error: "b/c.php" in phar "%sefcount1.phar.php", has open file pointers, cannot unlink in %sefcount1.php on line %d +object(PharFileInfo)#%d (0) { +} +string(5) "extra" +extra +===DONE=== -- 2.50.1