Bug #77516 [NEW]: ZipArchive::open not use default_charset setting
| From: | offluri at gmail dot com | Date: | Thu, 24 Jan 2019 16:10:43 +0000 |
| Subject: | Bug #77516 [NEW]: ZipArchive::open not use default_charset setting | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219175@lists.php.net to get a copy of this message | ||
From: offluri at gmail dot com
Operating system: Windows 7
PHP version: 7.2.14
Package: Zip Related
Bug Type: Bug
Bug description:ZipArchive::open not use default_charset setting
Description:
------------
Hello,
I'm working in windows (french) on a console php script with
Windows-1252 charset.
I'm change default_charset seting in php.ini :
default_charset = "Windows-1252"
My script convert a .ods file in a .sql script with using phpspreadsheet
lib.
I'm use a batch file to launch my php script. This allow drag-and-drop
file over .bat to launch conversion.
Problem : This not work with filename countain accentuated char. Problem
is in ZipArchive::Open(). Filename must be encoded with UTF-8 charset to
work.
Before open file, phpspreadsheet verify if file exist and readable with
use is_file() and is_readable(). In this function, filename must be
encoded with default_charset setting.
So i have a problem : If I translate filename to UTF-8, it's not work
(is_file() block) but when i left CP1252 charset, ZipArchive::Open() not
work.
This is inconsistent. Can you modify ZipArchive::Open()for this function
use default_charset setting for filename parameters ?
Ty
Test script:
---------------
// For just test ZipArchive :
$zip = new ZipArchive();
$res = $zip->open("Différence.ods");
if ($res!== true) {
echo 'FAIL';
} else {
echo 'OK';
}
Expected result:
----------------
OK
(In Windows with "Différence.ods" LibreOffice calc file AND
default_charset = "Windows-1252" in php.ini)
Actual result:
--------------
FAIL
(In Windows with "Différence.ods" LibreOffice calc file AND
default_charset = "Windows-1252" in php.ini)
--
Edit bug report at https://bugs.php.net/bug.php?id=77516&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77516&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77516&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77516&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77516&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77516&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77516&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77516&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77516&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77516&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77516&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77516&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77516&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77516&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77516&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77516&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77516&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77516&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77516&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77516&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77516&r=mysqlcfg