Bug #79806 [Csd->ReO]: realpath() erroneously resolves link to link

From: Date: Mon, 27 Jul 2020 15:54:20 +0000
Subject: Bug #79806 [Csd->ReO]: realpath() erroneously resolves link to link
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228240@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79806&edit=1

 ID:                 79806
 Updated by:         cmb@php.net
 Reported by:        cmb@php.net
 Summary:            realpath() erroneously resolves link to link
-Status:             Closed
+Status:             Re-Opened
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Windows NTS
 PHP Version:        7.3
 Assigned To:        cmb
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2020-07-27 15:54:07] cmb@php.net

Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1aeff522b8e5ee77b9ae91bab59699db4dfc2c7e
Log: Revert "Fix #79806: realpath() erroneously resolves link to link"

------------------------------------------------------------------------
[2020-07-27 13:12:20] cmb@php.net

Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d5b59b4303642adac91df2c93969a72bc0f5fa7d
Log: Fix #79806: realpath() erroneously resolves link to link

------------------------------------------------------------------------
[2020-07-15 16:39:12] cmb@php.net

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

------------------------------------------------------------------------
[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)

« previous php.bugs (#228240) next »