|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-11 10:05 UTC] nescha at gmail dot com
[2015-05-05 14:34 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2015-05-05 14:34 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Description: ------------ If you create ZIP file with custom assigned UTF-8 filenames for compressed files, resulting ZIP won't save those filenames correctly. Reproduce code: --------------- <?php $files = array( '0.txt' => 'regular.txt', '1.txt' => '??????.txt', '2.txt' => '?đ?ćđ?.txt', '3.txt' => 'цирилиц.txt' ); $zip = new ZipArchive(); $id = 'zipfile_' . time(); $filename = "$id.zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE)) { foreach ($files as $src => $name) { $zip->addFile($src, $name); } } $zip->close(); echo $id; ?> Expected result: ---------------- You'll get name of the created ZIP file. If you open/download that ZIP file, all the files that are compressed should have proper filename. Actual result: -------------- Only name of the first file is interpreted correctly. All others, which are UTF-8 encoded, are renamed with some strange characters.