php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47667 ZipArchive::OVERWRITE seems to have no effect
Submitted: 2009-03-15 21:55 UTC Modified: 2009-03-16 10:22 UTC
From: mkoppanen@php.net Assigned: pajoye (profile)
Status: Closed Package: Zip Related
PHP Version: 5.2.9 OS: Debian Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mkoppanen@php.net
New email:
PHP Version: OS:

 

 [2009-03-15 21:55 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-16 10:22 UTC] mkoppanen@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC