Bug #73877 [Com]: readlink() returns garbage for UTF paths
| From: | kulakov74 at yandex dot ru | Date: | Sat, 07 Jan 2017 20:25:33 +0000 |
| Subject: | Bug #73877 [Com]: readlink() returns garbage for UTF paths | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206362@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
Comment by: kulakov74 at yandex dot ru
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:
It works for all:
c:\Temp\СеÑежка
\\Pc3\абвгдеабвгдеабвгдеабвгде
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2017-01-06 19:51:08] ab@php.net
Thanks for the report. Double quotes will lead to the backslash extrapolation, backslash need to be
escaped therefore. Need also to know, what kind of link is that? Also - is the string passed UTF-8
encoded? Could you provide maybe an exact mklink command or alike, to get the reproducer? I've
just tried with a junction and see no issue.
Thanks.
------------------------------------------------------------------------
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