|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-05-03 22:43 UTC] pajoye@php.net
-Status: Open
+Status: Feedback
[2012-05-03 22:43 UTC] pajoye@php.net
[2012-05-03 22:58 UTC] david at panmedia dot co dot nz
[2012-05-03 23:04 UTC] pajoye@php.net
[2012-05-03 23:11 UTC] david at panmedia dot co dot nz
[2012-05-04 09:28 UTC] pajoye@php.net
[2013-02-18 00:35 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Description: ------------ When creating a symlink in Windows to an absolute path with a lower case drive letter, PHP will not resolve the canonicalized absolute pathname (realpath) correctly. This is obvious when you have nested symlinks. When you run realpath of a nested symlink it returns the next symlink it links to, rather than the top absolute pathname. On Linux it works correctly. One work around that can be used is: $link = 'f:\link3'; do { $link = realpath($link); } while (realpath($link) !== false && $link !== realpath($link)); Test script: --------------- Windows test: F:\>mkdir target F:\>mklink /D link1 f:\target F:\>mklink /D link2 f:\link1 F:\>mklink /D link3 f:\link2 F:\>php -r "var_dump(realpath('link3'));" Linux test: $ mkdir target $ ln -s target link1 $ ln -s link1 link2 $ ln -s link2 link3 $ php -r "var_dump(realpath('link3'));" Expected result: ---------------- Windows test: string(9) "F:\target" Linux test: string(12) "/root/target" Actual result: -------------- Windows test: string(9) "f:\\link2" Linux test: string(12) "/root/target"