summaryrefslogtreecommitdiff
path: root/ext/phar/tests/open_for_write_existing.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar/tests/open_for_write_existing.phpt')
-rw-r--r--ext/phar/tests/open_for_write_existing.phpt31
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/phar/tests/open_for_write_existing.phpt b/ext/phar/tests/open_for_write_existing.phpt
new file mode 100644
index 0000000000..2a3ec8b824
--- /dev/null
+++ b/ext/phar/tests/open_for_write_existing.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Phar: fopen a .phar for writing (existing file)
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("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 'files/phar_test.inc';
+
+$fp = fopen($pname . '/b/c.php', 'wb');
+fwrite($fp, 'extra');
+fclose($fp);
+include $pname . '/b/c.php';
+?>
+
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+--EXPECTF--
+extra
+===DONE===