Bug #75557 [Opn->Ver]: Error opening archive w/non-english chars in path
| From: | cmb@php.net | Date: | Tue, 30 Nov 2021 16:28:40 +0000 |
| Subject: | Bug #75557 [Opn->Ver]: Error opening archive w/non-english chars in path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-238062@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75557&edit=1
ID: 75557
Updated by: cmb@php.net
Reported by: piven dot m at gmail dot com
Summary: Error opening archive w/non-english chars in path
-Status: Open
+Status: Verified
Type: Bug
-Package: rar
+Package: *General Issues
Operating System: Windows (7, Srv2008)
PHP Version: 7.1.11
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2017-11-23 07:28:19] piven dot m at gmail dot com
Description:
------------
Attempt to open archive with non-english (cyrilic) characters in the path results a read error:
Warning: RarArchive::open(): Failed to open C:\php\папка\test.rar: ERAR_EOPEN (file
open error) in C:\php\testrar.php on line 2
My attempt to replace the char* with zend_string* was unsuccessful in function
PHP_FUNCTION(rar_open).
Test script:
---------------
This scripts get same errors:
<?php
// In this script i'm try to open archive, called "ÑеÑÑ.rar" from folder
"папка" (Russian Cyrilic, UTF-8 filepath in php7.1)
$rar = RarArchive::open(__DIR__ .'/папка/ÑеÑÑ.rar');
// In this moment i get "ERAR_EOPEN (file open error)" warning
if(false !== $rar) {
print_r($rar->getEntries());
$rar->close();
}
?>
Ok. Let's try to recode path from UTF-8 to WINDOWS-1251:
<?php
// Recode by iconv
$rar = RarArchive::open(iconv('UTF-8','WINDOWS-1251',__DIR__
.'/папка/ÑеÑÑ.rar'));
// But still have same "ERAR_EOPEN (file open error)" warning
if(false !== $rar) {
print_r($rar->getEntries());
$rar->close();
}
?>
Expected result:
----------------
Array
(
[0] => RarEntry Object
(
[rarfile:RarEntry:private] => RarArchive Object
(
)
[position:RarEntry:private] => 0
[name:RarEntry:private] => php.exe
[unpacked_size:RarEntry:private] => 127488
[packed_size:RarEntry:private] => 45642
[host_os:RarEntry:private] => 2
[file_time:RarEntry:private] => 2017-11-23 09:56:08
[crc:RarEntry:private] => 23791171
[attr:RarEntry:private] => 32
[version:RarEntry:private] => 29
[method:RarEntry:private] => 53
[flags:RarEntry:private] => 0
[redir_type:RarEntry:private] => 0
[redir_to_directory:RarEntry:private] =>
[redir_target:RarEntry:private] =>
)
[1] => RarEntry Object
(
[rarfile:RarEntry:private] => RarArchive Object
(
)
[position:RarEntry:private] => 1
[name:RarEntry:private] => ÑеÑÑ.rar
[unpacked_size:RarEntry:private] => 15645
[packed_size:RarEntry:private] => 15645
[host_os:RarEntry:private] => 2
[file_time:RarEntry:private] => 2017-11-23 09:29:38
[crc:RarEntry:private] => e5f65ba2
[attr:RarEntry:private] => 32
[version:RarEntry:private] => 29
[method:RarEntry:private] => 48
[flags:RarEntry:private] => 0
[redir_type:RarEntry:private] => 0
[redir_to_directory:RarEntry:private] =>
[redir_target:RarEntry:private] =>
)
)
Actual result:
--------------
Warning: RarArchive::open(): Failed to open C:\php\папка\test.rar: ERAR_EOPEN (file
open error) in C:\php\testrar.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75557&edit=1