ID: 48084 Updated by: paj...@php.net Reported By: darrenkarstens at googlemail dot com -Status: Open +Status: Feedback Bug Type: Output Control Operating System: Windows XP PHP Version: 5.2.9 -Assigned To: +Assigned To: pajoye New Comment:
Please provide a link to the archive you use for this test. Previous Comments: ------------------------------------------------------------------------ [2009-04-27 08:46:17] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48084&edit=1