php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76460 Windows absolute symbolic links created without drive letter.
Submitted: 2018-06-12 02:29 UTC Modified: 2018-06-12 12:04 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: php dot net at sameprecision dot org Assigned:
Status: Open Package: *General Issues
PHP Version: 7.2.6 OS: Windows Server 2016
Private report: No CVE-ID: None
 [2018-06-12 02:29 UTC] php dot net at sameprecision dot org
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





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-12 12:04 UTC] cmb@php.net
Related to bug #60841.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 21:01:28 2024 UTC