From: Greg Beaver Date: Tue, 2 Jan 2007 20:07:54 +0000 (+0000) Subject: add new failing test for write support X-Git-Tag: RELEASE_1_0_0RC1~430 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a90c542188fe0ce1c563d1f7153885576fa420c7;p=php add new failing test for write support --- 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..769f6e4640 --- /dev/null +++ b/ext/phar/tests/open_for_write_existing.phpt @@ -0,0 +1,38 @@ +--TEST-- +Phar: fopen a .phar for writing (existing file) +--SKIPIF-- + +--FILE-- +"; + +$files = array(); +$files['a.php'] = ''; +$files['b.php'] = ''; +$files['b/c.php'] = ''; +$manifest = ''; +foreach($files as $name => $cont) { + $len = strlen($cont); + $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00); +} +$alias = ''; +$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest; +$file .= pack('V', strlen($manifest)) . $manifest; +foreach($files as $cont) +{ + $file .= $cont; +} + +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); + +$fp = fopen('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php', 'wb'); +fwrite($fp, 'extra'); +fclose($fp); +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php'; +?> +===DONE=== +--CLEAN-- + +--EXPECT-- +extra +===DONE===