|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-27 08:47 UTC] pajoye@php.net
[2009-04-27 10:47 UTC] darrenkarstens at googlemail dot com
[2009-05-05 01:00 UTC] php-bugs at lists dot php dot net
[2009-08-10 15:43 UTC] pajoye@php.net
[2009-08-18 01:00 UTC] php-bugs at lists dot php dot net
[2009-12-15 00:45 UTC] felipe@php.net
[2009-12-22 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 13:00:02 2025 UTC |
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.