Bug #75063 [Fbk->Csd]: Many filesystem-related functions do not work with multibyte file names

From: Date: Sun, 13 Aug 2017 22:54:43 +0000
Subject: Bug #75063 [Fbk->Csd]: Many filesystem-related functions do not work with multibyte file names
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210665@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75063&edit=1 ID: 75063 Updated by: ab@php.net Reported by: anrdaemon at freemail dot ru Summary: Many filesystem-related functions do not work with multibyte file names -Status: Feedback +Status: Closed Type: Bug Package: Filesystem function related Operating System: Windows PHP Version: 7.1.8 Assigned To: ab Block user comment: N Private report: N New Comment: Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=3069ad8dd1400f19a28230d3028048a27d07ce8d Log: Fixed bug #75063 Previous Comments: ------------------------------------------------------------------------ [2017-08-13 13:53:37] anrdaemon at freemail dot ru My apology, it's a zip issue. Totally forgot that there's no standard way to encode file names in zip archives. The original name was "тест-75063". I reuploaded the archive for your convenience. http://www.rootdir.org/upload/Bugs/PHP-75063/php-75063.tar.xz The build I'm using is the 7.1.8 64-bit TS release from http://windows.php.net/download#php-7.1 The "output.txt" contains essential part of the phpinfo() (minus credits and environment dump). If there's anything in the environment, that could make a difference on the results, please let me know and I'll fill the gaps. ------------------------------------------------------------------------ [2017-08-12 17:51:57] ab@php.net @arndaemon which exact build did you use? From the supplied archive - the folder in the root is shown as "ΓÑßΓ-75063". It might be either a packaging error, or possibly something on the HD that could be a cause. If latter, which kind of FS is that, like local HD, NTFS, Samba, etc.? Thanks. ------------------------------------------------------------------------ [2017-08-11 15:19:10] anrdaemon at freemail dot ru The bug #72555 (parent of those mentioned) is about dealing with console codepage. The present issue is strictly internal. Here, I modified the test script a little and supplied the example output from running it with "php -nf ..." http://www.rootdir.org/upload/Bugs/PHP-75063/php-75063.zip ------------------------------------------------------------------------ [2017-08-11 13:02:33] requinix@php.net I can get the correct result and various different incorrect results, but not your result. You're running PHP 7.1.8 and not an earlier version? What does echo chcp show? Have you looked at the comments in other similar bug reports (like #74589, #72555, and your earlier #73716) for anything that appears relevant? ------------------------------------------------------------------------ [2017-08-11 12:04:29] anrdaemon at freemail dot ru Weird. Works for me if only filename contains multibyte characters, but breaks when path contains them also, but again, only for multibyte file names. Can you please try it with parent directory name contaning multibyte characters? Another interesting finding: getcwd() returns natively encoded filename. $ php.exe -nf opendir.php <?php print file_get_contents(__FILE__) . "-- \n"; print ini_get("internal_encoding") . "\n"; print ini_get("default_charset") . "\n"; print getcwd() . "\n"; print iconv('CP1251', 'UTF-8', getcwd()) . "\n"; foreach(["test", "тест"] as $fn) file_put_contents("$fn.txt", ""); if ($dh = opendir(getcwd())) { while (($file = readdir($dh)) !== false) { echo "filename: $file : filetype: " . filetype($file) . "\n"; } closedir($dh); } -- UTF-8 C:\dev\temp\ C:\dev\temp\тест filename: . : filetype: dir filename: .. : filetype: dir filename: opendir.php : filetype: file filename: test.txt : filetype: file filename: UTF-8.php : filetype: file Warning: filetype(): Lstat failed for тест.txt in C:\dev\temp\тест\opendir.php on line 12 filename: тест.txt : filetype: ------------------------------------------------------------------------ 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=75063 -- Edit this bug report at https://bugs.php.net/bug.php?id=75063&edit=1

« previous php.bugs (#210665) next »