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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
47 - 22 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 14:01:31 2024 UTC