Annotation of embedaddon/php/ext/phar/tests/bug13786.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: bug #13786: "PHP crashes on phar recreate after unlink"
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.require_hash=0
7: phar.readonly=0
8: --FILE--
9: <?php
10:
11: try {
12: for ($i = 0; $i < 2; $i++) {
13: $fname = "DataArchive.phar";
14: $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $fname;
15: $phar = new Phar($path);
16: $phar->addFromString($i, "file $i in $fname");
17: var_dump(file_get_contents($phar[$i]));
18: unset($phar);
19: unlink($path);
20: }
21:
22: echo("\nWritten files: $i\n");
23: } catch (Exception $e) {
24: echo $e->getMessage() . "\n";
25: }
26:
27: ?>
28: ===DONE===
29: --EXPECTF--
30: string(26) "file 0 in DataArchive.phar"
31: unable to seek to start of file "0" while creating new phar "%sDataArchive.phar"
32: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>