Bug #72200 [NEW]: ZipArchive::open() creates invalidly encoded filenames
| From: | thomas dot kuhn dot berlin at gmail dot com | Date: | Wed, 11 May 2016 16:30:27 +0000 |
| Subject: | Bug #72200 [NEW]: ZipArchive::open() creates invalidly encoded filenames | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201024@lists.php.net to get a copy of this message | ||
From: thomas dot kuhn dot berlin at gmail dot com
Operating system: Windows Server 2012 R2 & Win7
PHP version: 7.0.6
Package: Zip Related
Bug Type: Bug
Bug description:ZipArchive::open() creates invalidly encoded filenames
Description:
------------
New in PHP7 on Windows: When filenames contain non-us-ascii-letters like
öäü or asian chars etc., ZipArchive creates filenames in a way that
those files are not accessible via PHP because the encoding is wrong.
testscript output PHP 5.5.35:
php default_charset: UTF-8
bool(true)
testscript output PHP 7.0.6:
php default_charset: UTF-8
bool(false)
run on Windows Server 2012 R2 and Windows7
Test script:
---------------
print "php default_charset: ".ini_get('default_charset')."\n"; // just
4
info (UTF-8)
$filename = "bugtest_müller-lüdenscheid.zip"; // just an example
$filename = utf8_encode($filename); // simulating my database delivering
utf8-string
$zip = new ZipArchive();
if( $zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE)
=== true )
{
$zip->addFile('bugtest.php', 'bugtest.php'); // copy of script file
itself
$zip->close();
}
var_dump( is_file($filename) ); // delivers ?
--
Edit bug report at https://bugs.php.net/bug.php?id=72200&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72200&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72200&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72200&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72200&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72200&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72200&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72200&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72200&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72200&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72200&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72200&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72200&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72200&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72200&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72200&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72200&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72200&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72200&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72200&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72200&r=mysqlcfg