Bug #77639 [Com]: Wrong behavior of getting paths for symlink

From: Date: Tue, 19 Feb 2019 19:00:05 +0000
Subject: Bug #77639 [Com]: Wrong behavior of getting paths for symlink
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219641@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77639&edit=1 ID: 77639 Comment by: mesaverde228 at gmail dot com Reported by: mesaverde228 at gmail dot com Summary: Wrong behavior of getting paths for symlink Status: Feedback Type: Bug Package: *Directory/Filesystem functions Operating System: Windows/Linux PHP Version: 7.1.26 Block user comment: N Private report: N New Comment: if I change mklink /J D:\test\symlinkedcachefolder D:\test\realcachefolder to mklink /d D:\test\symlinkedcachefolder D:\test\realcachefolder I got following response from CMD symbolic link created for D:\test\symlinkedcachefolder <<===>> D:\test\realcachefolder But the script "index.php" works the same as for "junction" D:\test\symlinkedcachefolder>php index.php array(4) { ["realpath(__DIR__)"]=> string(23) "D:\test\realcachefolder" ["realpath("D:\test\symlinkedcachefolder\gretta")"]=> bool(false) ["dirname(__DIR__)"]=> string(7) "D:\test" ["dirname(__DIR__ . "\gretta")"]=> string(23) "D:\test\realcachefolder" } Previous Comments: ------------------------------------------------------------------------ [2019-02-19 18:57:00] requinix@php.net > Is that means that windows "junctions" not supported by PHP? Depends what "support" you are expecting. ------------------------------------------------------------------------ [2019-02-19 18:55:05] requinix@php.net The only bug I can see here is that realpath() on a junction is resolving it D:\test\symlinkedcachefolder>php -r "var_dump(realpath('D:/test/symlinkedcachefolder'));" string(23) "D:\test\realcachefolder" when last I knew PHP deliberately did not - only symlinks. Do you agree? ------------------------------------------------------------------------ [2019-02-19 18:53:30] mesaverde228 at gmail dot com Is that means that windows "junctions" not supported by PHP? ------------------------------------------------------------------------ [2019-02-19 16:55:03] cmb@php.net Junctions are not symlinks. ------------------------------------------------------------------------ [2019-02-19 11:34:02] mesaverde228 at gmail dot com Description: ------------ There is some difference in interpretation symlinked folder on different platforms Test script: --------------- https://gist.github.com/inri13666/4f7484af32ac7eba81b0d1bf8a5a5111 Expected result: ---------------- I assume that result for index.php should be almost the same. Also possibly __DIR__ should point to the symlink(junction) path instead of a physical path. Actual result: -------------- https://gist.github.com/inri13666/4f7484af32ac7eba81b0d1bf8a5a5111 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77639&edit=1

« previous php.bugs (#219641) next »