|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-16 10:22 UTC] mkoppanen@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 11:00:01 2025 UTC |
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