php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30989 Multiple include/require case problem with drive letters
Submitted: 2004-12-06 01:21 UTC Modified: 2008-02-14 01:06 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: info at e-novative dot de Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.0.2 OS: Windows XP
Private report: No CVE-ID: None
 [2004-12-06 01:21 UTC] info at e-novative dot de
Description:
------------
Include and require treat drive letters in path names case-sensitive (whereas Windows does not). This leads to (unjustified) "Cannot redeclare ..." errors for classes or functions in certain situations.

Reproduce code:
---------------
include_once 'c:/some/path/file.php';
include_once 'c:/some/PATH/file.php';
include_once 'C:/some/path/file.php';

(assume file.php contains a function or class definition)

Expected result:
----------------
Running all three include statements should be safe, as the path definitely points to the same directory on Windows. I remember PHP4 used to choke on the second include because paths were treated case-insensitive, however PHP5 chokes on the third one.

Actual result:
--------------
The third include_once statement yields an error
"Cannot redeclare ... (previously declared in ...) ..."

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-06 11:05 UTC] derick@php.net
This has already been suggested before, please search the bug system before posting bugs.
 [2004-12-06 11:17 UTC] info at e-novative dot de
BTW, I _did_ search the database, but I didn't find this one. It didn't even show up on the final confirmation page, so I was pretty sure that was a new one. Sorry for that.

But why is this a "won't fix"? It is a behaviour that is not desired, and I was banging my head for two days because my Unit Tests just would show up error when run fom phing.

It shouldn't be too difficult to make PHP's internal list of files case _insensitive_ on Windows? Would this introduce any problem in another spot - I doubt it? It seems to be case insensitive anyway right now (see the second include in the example) - but not for the drive letter.
 [2008-02-14 01:06 UTC] stas@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

I think this was fixed somewhere in 5.2, but definitely works for me in 5.3.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC