|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-06-12 12:04 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 15:00:02 2025 UTC |
Description: ------------ Absolute symbolic links for local drives created in a standard cmd shell without drive letter using mklink are not followed in PHP. For instance, in cmd, "mklink /d c:\tmp\windows \windows" creates a symbolic link (directory) to c:\windows. In PHP, is_dir('c:/tmp/windows') returns false. is_link('c:/tmp/windows') returns true. readlink('c:/tmp/windows') returns "c:/windows". is_dir('/windows') returns true. If the link is created with the drive letter, is_dir/is_file returns true. This seems like an inconsistency given that is_file/is_dir recognize absolute paths to files/directories that do not include the drive letter. Test script: --------------- Windows cmd shell without drive letter: mkdir c:\tmp mklink /d c:\tmp\windows \windows PHP interactive CLI (php -a): is_dir('c:/tmp/windows') == true //false is_dir('/windows') == true //true readlink('c:/tmp/windows') == 'c:\windows' //true Windows cmd shell with drive letter: mkdir c:\tmp mklink /d c:\tmp\windows c:\windows PHP interactive CLI (php -a): is_dir('c:/tmp/windows') == true //true is_dir('/windows') == true //true readlink('c:/tmp/windows') == 'c:\windows' //true