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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php dot net at sameprecision dot org
New email:
PHP Version: OS:

 

 [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: Fri Nov 22 03:01:27 2024 UTC