Bug #73758 [Com]: is_dir Drive:Folder returns true - unexpected behavior
| From: | steve dot baldwin at publisure dot com | Date: | Fri, 16 Dec 2016 11:25:46 +0000 |
| Subject: | Bug #73758 [Com]: is_dir Drive:Folder returns true - unexpected behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206055@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73758&edit=1
ID: 73758
Comment by: steve dot baldwin at publisure dot com
Reported by: steve dot baldwin at publisure dot com
Summary: is_dir Drive:Folder returns true - unexpected
behavior
Status: Not a bug
Type: Bug
Package: Directory function related
Operating System: Windows 8.1
PHP Version: 5.6.29
Block user comment: N
Private report: N
New Comment:
Wow! thats suprising.
Thank you for clarifying this. I'll close this ticket.
Previous Comments:
------------------------------------------------------------------------
[2016-12-16 11:06:32] requinix@php.net
Actually "C:PHP" is a valid path.
https://blogs.msdn.microsoft.com/jeremykuhne/2016/04/21/path-normalization/
------------------------------------------------------------------------
[2016-12-16 11:01:48] steve dot baldwin at publisure dot com
Description:
------------
If you call is_dir("D:MyFolder") when both the drive (D) and the folder (MyFolder) exists
it will return true. However windows will not resolve D:MyFolder as a valid path because a
forward/or back slash is omitted after the root drive.
The correct path is D:\MyFolder or D:/MyFolder and PHP should be returning false instead of true.
Test script:
---------------
//change this below to a valid drive and folder but omit the \\
$path = "C:PHP";
assert(is_dir($path) == false);
Actual result:
--------------
Warning: assert(): Assertion failed
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73758&edit=1