#37350 [Opn]: realpath doesn't canonicalize drive letter case
| From: | k95vz5f02 at sneakemail dot com | Date: | Sun, 07 May 2006 19:36:39 +0000 |
| Subject: | #37350 [Opn]: realpath doesn't canonicalize drive letter case | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-96780@lists.php.net to get a copy of this message | ||
ID: 37350
User updated by: k95vz5f02 at sneakemail dot com
Reported By: k95vz5f02 at sneakemail dot com
Status: Open
Bug Type: Filesystem function related
Operating System: Windows XP SP2
PHP Version: 5.1.4
New Comment:
bjori: Sorry, I don't understand what you're trying to say.
If you're suggesting that people have to use
strcasecmp(realpath($a),realpath($b))==0 to test if two files are the
same then:
a) That is unintuitive and undocumented, certainly contrary to the
principle of canonicalization.
b) That wouldn't work on Linux etc. where multiple files can have the
same name but differ in capitalisation.
Previous Comments:
------------------------------------------------------------------------
[2006-05-07 18:41:58] derick@php.net
Realpath is also used internally for f.e. include_once, so this should
be looked into.
------------------------------------------------------------------------
[2006-05-07 18:21:43] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
strcasecmp()
------------------------------------------------------------------------
[2006-05-07 18:08:28] k95vz5f02 at sneakemail dot com
Description:
------------
The realpath function doesn't canonicalize the case of the drive letter
on Windows (and possibly on certain other platforms).
For example:
realpath('C:\WINDOWS') returns 'C:\WINDOWS'
but realpath('c:\WINDOWS') returns 'c:\WINDOWS'
(note the different case of the 'C:')
Hence comparing realpaths cannot reliably be used to check that two
files are the same on Windows.
Reproduce code:
---------------
echo (realpath('C:\WINDOWS')==realpath('c:\WINDOWS')) ? "true" :
"false";
Expected result:
----------------
true
Actual result:
--------------
false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37350&edit=1