php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48084 Zip becomes corrupt when using ZipArchive
Submitted: 2009-04-27 08:46 UTC Modified: 2009-12-22 01:00 UTC
From: darrenkarstens at googlemail dot com Assigned: pajoye (profile)
Status: No Feedback Package: Output Control
PHP Version: 5.2.9 OS: Windows XP
Private report: No CVE-ID: None
 [2009-04-27 08:46 UTC] darrenkarstens at googlemail dot com
Description:
------------
When using the ZipArchive::renameIndex function to rename the files in a zip archive the zip becomes corrupt. I have tried several different zip files and they all become corrupt.

Reproduce code:
---------------
$client='TEST';
$zip = new ZipArchive();
if ($zip->open($targetpath,ZIPARCHIVE::OVERWRITE)===true)
{  
    // prefix all of the files with the clients name
    for($i = 0; $i < $zip->numFiles; $i++)
    {  
        $zip->renameIndex($i,$client.$zip->getNameIndex($i));
    } 
    if (!$zip->close()) echo 'Failed to rename zip';
}else echo'Failed to open zip';


Expected result:
----------------
This should open an existing zip archieve from the path $targetpath and prefix all of the filenames of its files with the word 'TEST'.

Actual result:
--------------
The files do appear to get renamed when I open the finished archieve however I am unable to extract the files from the zip because they are corrupt.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-27 08:47 UTC] pajoye@php.net
Please provide a link to the archive you use for this test.
 [2009-04-27 10:47 UTC] darrenkarstens at googlemail dot com
Here is a link to one of the files I tried http://65.75.249.187/sc_pop_2000.zip
 [2009-05-05 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-08-10 15:43 UTC] pajoye@php.net
Can you upload the archive again and/or verify with a recent version? 
 [2009-08-18 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-12-15 00:45 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-12-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC