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

 ID:                 75557
 Updated by:         c...@php.net
 Reported by:        piven dot m at gmail dot com
 Summary:            Error opening archive w/non-english chars in path
 Status:             Verified
 Type:               Bug
 Package:            PECL
 Operating System:   Windows (7, Srv2008)
 PHP Version:        7.1.11
-Assigned To:        cmb
+Assigned To:        
 Block user comment: N
 Private report:     N

 New Comment:

I submitted <https://github.com/cataphract/php-rar/pull/16> as a
PoC/starting point.


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

-- 
PECL development discussion Mailing List (https://pecl.php.net/)
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to