summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteph Fox <sfox@php.net>2008-04-29 10:45:23 +0000
committerSteph Fox <sfox@php.net>2008-04-29 10:45:23 +0000
commit7762c5d204d122a3207e8aa8e19282539c8c9fad (patch)
tree735022738af68281f15b99c4a8116451e9a6baac
parent6b00f4493495623a7af4555a23233d7b349a1c96 (diff)
downloadphp-git-7762c5d204d122a3207e8aa8e19282539c8c9fad.tar.gz
- Add test for bug #13786
-rw-r--r--ext/phar/tests/bug13786.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/phar/tests/bug13786.phpt b/ext/phar/tests/bug13786.phpt
new file mode 100644
index 0000000000..68c47e94a3
--- /dev/null
+++ b/ext/phar/tests/bug13786.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Phar: bug #13786: "PHP crashes on phar recreate after unlink"
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--INI--
+phar.require_hash=0
+phar.readonly=0
+--FILE--
+<?php
+
+for ($i = 0; $i < 2; $i++) {
+ $fname = "DataArchive.phar";
+ $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $fname;
+ $phar = new Phar($path);
+ $phar->addFromString($i, "file $i in $fname");
+ var_dump(file_get_contents($phar[$i]));
+ unset($phar);
+ unlink($path);
+}
+
+echo("\nWritten files: $i\n");
+
+?>
+===DONE===
+--EXPECT--
+string(26) "file 0 in DataArchive.phar"
+string(26) "file 1 in DataArchive.phar"
+
+Written files: 2
+===DONE===