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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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 10:01:29 2024 UTC