Bug #72200 [Ver->Csd]: ZipArchive::open() creates invalidly encoded filenames

From: Date: Tue, 10 Mar 2020 12:05:42 +0000
Subject: Bug #72200 [Ver->Csd]: ZipArchive::open() creates invalidly encoded filenames
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226003@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72200&edit=1

 ID:                 72200
 Updated by:         cmb@php.net
 Reported by:        thomas dot kuhn dot berlin at gmail dot com
 Summary:            ZipArchive::open() creates invalidly encoded
                     filenames
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            Zip Related
 Operating System:   Windows
 PHP Version:        7.0.6
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

This issue is supposed to be resolved as of PHP 7.1.0, which added
support for long and UTF-8 paths on Windows[1].

[1] <https://www.php.net/manual/en/migration71.windows-support.php#migration71.windows-support.long-and-utf8-path>


Previous Comments:
------------------------------------------------------------------------
[2016-05-24 11:49:22] speller at yandex dot ru

Related To: Bug #72258

------------------------------------------------------------------------
[2016-05-24 10:29:35] cmb@php.net

Related To: Bug #72258

------------------------------------------------------------------------
[2016-05-19 12:16:38] thomas dot kuhn dot berlin at gmail dot com

@cmb: great that you noticed that mistake and that you can verify the problem. thank you for your
time! your suggestions sound plosible to me but i have no real insight and therefor can't
participate in discussing the matter much. but it seems evident that ZipArchive behaves differently
then "the rest" of PHP.

------------------------------------------------------------------------
[2016-05-18 10:56:44] cmb@php.net

Thanks for testing the script. But actually, I have to apologize,
because I didn't carefully check my test results which were wrong
as I did run the script with PHP 5.6 first, which created the zip
file as expected, and later running with PHP 7.0.6 found the zip
created by the earlier run.

So, I can reproduce the issue with PHP 7.0.6 (both x86 and x64).
While file_put_contents("m\xc3\xbcller", …) creates the file
müller as expected, ZipArchive creates the file müller.
Apparently, ZipArchive maps filenames from UTF-8 to UTF-16/UCS-2,
while the plain file functions do not. That might be caused by
recent builds of the bundled libzip using the *W*idechar instead
of the *A*nsi variants of the WinAPI.

------------------------------------------------------------------------
[2016-05-17 15:57:07] thomas dot kuhn dot berlin at gmail dot com

@cmb: oh, sorry, you are right, i apologize :) i copyNpasted your script and executed it on my
system, the output was as follows:

bool(true)
bool(true)
bool(true)
bool(false)

Windows NT 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 
PHP/7.0.6 
Compiler: MSVC14 (Visual C++ 2015)
Architecture: x64

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=72200


--
Edit this bug report at https://bugs.php.net/bug.php?id=72200&edit=1


Thread (8 messages)

« previous php.bugs (#226003) next »