Bug #79806 [PATCH]: realpath() erroneously resolves link to link
Edit report at https://bugs.php.net/bug.php?id=79806&edit=1
ID: 79806
Patch added by: cmb@php.net
Reported by: cmb@php.net
Summary: realpath() erroneously resolves link to link
Status: Assigned
Type: Bug
Package: Filesystem function related
Operating System: Windows NTS
PHP Version: 7.3
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #79806: realpath() erroneously resolves link to link
On GitHub: https://github.com/php/php-src/pull/5861
Patch: https://github.com/php/php-src/pull/5861.patch
Previous Comments:
------------------------------------------------------------------------
[2020-07-07 15:19:45] cmb@php.net
Description:
------------
On Windows realpath() only resolves the first level (soft or hard)
link, but does not go further. This does neither match the
behavior on Linux (as far as I know), not the documentation which
states:
| The resulting path will have no symbolic link, [â¦]
Test script:
---------------
<?php
touch(__DIR__ . '/link.txt');
symlink(__DIR__ . '/link.txt', __DIR__ . '/link1.lnk');
symlink(__DIR__ . '/link1.lnk', __DIR__ . '/link2.lnk');
var_dump(substr(realpath(__DIR__ . '/link2.lnk'), strlen(__DIR__)));
?>
Expected result:
----------------
string(9) "\link.txt"
Actual result:
--------------
string(10) "\link1.lnk"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79806&edit=1
Thread (5 messages)