mkoppanen Mon Mar 16 10:19:43 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/zip/tests bug47667.phpt
Modified files: /php-src/ext/zip/lib zip_open.c Log: Closes bug #47667 http://cvs.php.net/viewvc.cgi/php-src/ext/zip/lib/zip_open.c?r1=1.1.2.4.2.6&r2=1.1.2.4.2.7&diff_format=u Index: php-src/ext/zip/lib/zip_open.c diff -u php-src/ext/zip/lib/zip_open.c:1.1.2.4.2.6 php-src/ext/zip/lib/zip_open.c:1.1.2.4.2.7 --- php-src/ext/zip/lib/zip_open.c:1.1.2.4.2.6 Fri Jan 2 00:07:57 2009 +++ php-src/ext/zip/lib/zip_open.c Mon Mar 16 10:19:43 2009 @@ -66,6 +66,9 @@ int i; off_t len; + if (flags & ZIP_OVERWRITE) { + return _zip_allocate_new(fn, zep); + } switch (_zip_file_exists(fn, flags, zep)) { case -1: http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/bug47667.phpt?view=markup&rev=1.1 Index: php-src/ext/zip/tests/bug47667.phpt +++ php-src/ext/zip/tests/bug47667.phpt --TEST-- Bug #47667 (ZipArchive::OVERWRITE seems to have no effect) --SKIPIF-- <?php /* $Id: bug47667.phpt,v 1.1 2009/03/16 10:16:16 mkoppanen Exp $ */ if(!extension_loaded('zip')) die('skip'); ?> --FILE-- <?php $thisdir = dirname(__FILE__); $filename = $thisdir . "/bug47667.zip"; $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::CREATE) !== true) { exit("Unable to open the zip file"); } else { $zip->addFromString('foo.txt', 'foo bar foobar'); $zip->close(); } for ($i = 0; $i < 10; $i++) { $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) { exit("Unable to open the zip file"); } $zip->addFromString("foo_{$i}.txt", 'foo bar foobar'); $zip->close(); } $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::CREATE) !== true) { exit("Unable to open the zip file"); } echo "files: " , $zip->numFiles; unlink($filename); --EXPECT-- files: 1 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php