#47667 [Opn->Csd]: ZipArchive::OVERWRITE seems to have no effect
| From: | mkoppanen@php.net | Date: | Mon, 16 Mar 2009 10:22:59 +0000 |
| Subject: | #47667 [Opn->Csd]: ZipArchive::OVERWRITE seems to have no effect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134733@lists.php.net to get a copy of this message | ||
ID: 47667
Updated by: mkoppanen@php.net
Reported By: mkoppanen@php.net
-Status: Open
+Status: Closed
Bug Type: Zip Related
Operating System: Debian Linux
PHP Version: 5.2.9
Assigned To: pajoye
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-03-15 21:55:01] mkoppanen@php.net
Description:
------------
ZipArchive::OVERWRITE flag has no effect. Even if the flag is passed to
ZipArchive::open method new files seem to be appended rather than
overwrite the existing files.
Reproduce code:
---------------
<?php
$File = 'test.zip';
$zip = new ZipArchive;
$res = $zip->open($File, ZipArchive::CREATE);
if($res === true)
{
$zip->addFromString('foo.txt', 'foo bar foobar');
$zip->close();
echo "ok\n";
}
else
{
echo "failed errno: ". $res ."\n\n";
}
unset($zip);
$zip = new ZipArchive;
$res = $zip->open($File, ZipArchive::OVERWRITE);
if($res === true)
{
$zip->addFromString('bar.txt', 'foo bar foobar');
$zip->close();
echo "ok\n";
}
else
{
echo "failed errno: ". $res ."\n\n";
}
unset($zip);
Expected result:
----------------
Zip file containing bar.txt
Actual result:
--------------
Zip file containing foo.txt and bar.txt
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47667&edit=1