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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-12 12:04 UTC] cmb@php.net
Related to bug #60841.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 17:01:41 2019 UTC