Bug #73877 [Csd]: readlink() returns garbage for UTF paths

From: Date: Sat, 07 Jan 2017 23:01:34 +0000
Subject: Bug #73877 [Csd]: readlink() returns garbage for UTF paths
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206367@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73877&edit=1 ID: 73877 Updated by: ab@php.net Reported by: kulakov74 at yandex dot ru Summary: readlink() returns garbage for UTF paths Status: Closed Type: Bug Package: Filesystem function related Operating System: Windows 8.1 PHP Version: 7.1.0 Assigned To: ab Block user comment: N Private report: N New Comment: Thanks very much for the checks! Previous Comments: ------------------------------------------------------------------------ [2017-01-07 20:25:33] kulakov74 at yandex dot ru It works for all: c:\Temp\Сережка \\Pc3\абвгдеабвгдеабвгдеабвгде ------------------------------------------------------------------------ [2017-01-07 00:44:19] ab@php.net It'd rock if you could check with the latest snapshots, also involving some UNC path. Thanks. ------------------------------------------------------------------------ [2017-01-07 00:12:35] ab@php.net Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=0f410f8087f44f3ce347a207f90be64ce3f64d80 Log: Fixed bug #73877 readlink() returns garbage for UTF-8 paths ------------------------------------------------------------------------ [2017-01-06 20:34:05] kulakov74 at yandex dot ru A follow-up: I tried the test script with various directories and the returned string always has the last directory cut about halfway, but at the same time the 1st half that is returned is correct (not garbage). So it looks like the problem is merely in allocating enough length for the result string. ------------------------------------------------------------------------ [2017-01-06 20:24:18] kulakov74 at yandex dot ru Yes, thank you, but in this particular case it doesn't matter - everything works the same way with "\\". And sorry, I didn't make it quite clear: in my case, the directory is NOT a link, so readlink() should return the dir, not a target, but it DOESN'T, so my script thinks it IS A LINK. So no mklink command had been used. I use ini_set('default_charset', 'UTF-8'); and then I get the dir from opendir()/readdir(), so it should be UTF-8. ------------------------------------------------------------------------ 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=73877 -- Edit this bug report at https://bugs.php.net/bug.php?id=73877&edit=1

« previous php.bugs (#206367) next »