#48084 [NEW]: Zip becomes corrupt when using ZipArchive
| From: | darrenkarstens at googlemail dot com | Date: | Mon, 27 Apr 2009 08:46:17 +0000 |
| Subject: | #48084 [NEW]: Zip becomes corrupt when using ZipArchive | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-136350@lists.php.net to get a copy of this message | ||
From: darrenkarstens at googlemail dot com
Operating system: Windows XP
PHP version: 5.2.9
PHP Bug Type: Output Control
Bug description: Zip becomes corrupt when using ZipArchive
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.
--
Edit bug report at http://bugs.php.net/?id=48084&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48084&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48084&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48084&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48084&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48084&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48084&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48084&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48084&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48084&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48084&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48084&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48084&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48084&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48084&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48084&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48084&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48084&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48084&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48084&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48084&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48084&r=mysqlcfg