]> granicus.if.org Git - php/commitdiff
failing test that demonstrates existing file pointer and PharFileInfo don't respond...
authorGreg Beaver <cellog@php.net>
Tue, 16 Jan 2007 03:21:55 +0000 (03:21 +0000)
committerGreg Beaver <cellog@php.net>
Tue, 16 Jan 2007 03:21:55 +0000 (03:21 +0000)
ext/phar/tests/refcount1.phpt [new file with mode: 0644]

diff --git a/ext/phar/tests/refcount1.phpt b/ext/phar/tests/refcount1.phpt
new file mode 100644 (file)
index 0000000..bafdc86
--- /dev/null
@@ -0,0 +1,43 @@
+--TEST--
+Phar: test that refcounting avoids problems with deleting a file
+--SKIPIF--
+<?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.readonly=0
+phar.require_hash=0
+--FILE--
+<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
+$file = "<?php __HALT_COMPILER(); ?>";
+
+$files = array();
+$files['a.php'] = '<?php echo "This is a\n"; ?>';
+$files['b.php'] = '<?php echo "This is b\n"; ?>';
+$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
+include 'phar_test.inc';
+
+$fp = fopen($pname . '/b/c.php', 'wb');
+fwrite($fp, "extra\n");
+fclose($fp);
+$p = new Phar($fname);
+$b = fopen($pname . '/b/c.php', 'rb');
+$a = $p['b/c.php'];
+echo $a;
+echo fread($b, 20);
+rewind($b);
+unlink($pname . '/b/c.php');
+echo $a;
+echo fread($b, 20);
+include $pname . '/b/c.php';
+?>
+
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+--EXPECTF--
+extra
+extra
+
+Warning: include(): Failed opening 'phar://%s/b/c.php): for inclusion (include_path='%s') in %s on line 27
+===DONE===