Edit report at https://bugs.php.net/bug.php?id=49625&edit=1
ID: 49625
Comment by: mrex at interport dot net
Reported by: jo at feuersee dot de
Summary: spl_autoload and case sensitivity
Status: Not a bug
Type: Bug
Package: SPL related
Operating System: Linux
PHP Version: 5.3.0
Block user comment: N
Private report: N
New Comment:
After having lost 2 days over this, I agree, this should be fixed. At the very least, it should be
documented that spl_autoload lower cases filenames. I spent hours trying to register an autoload
class that would fix this, but in vain. How can I know that "dataloader" should be mapped
to "DataLoader"?
If it had been documented that filenames were lowercased, I would not have spent hours banging my
head against a brick wall...
Previous Comments:
------------------------------------------------------------------------
[2012-05-14 23:45:55] david at panmedia dot co dot nz
Please fix this
------------------------------------------------------------------------
[2011-09-05 01:32:08] blake dot soley at gmail dot com
I agree, this bug is not bogus. In fact, it's actually quite serious. Just because
spl_autoload was designed poorly doesn't mean it has to remain broken. Several fixes have been
proposed, please consider implementing one of them to make this function cross-platform, and
therefore useful.
------------------------------------------------------------------------
[2011-08-10 01:13:40] bram048 at gmail dot com
I agree with Simon. There is absolutely no reason not to fix this, while keeping
backwards compatibility.
Two years ago the reason for not fixing it was "breaking BC is not an option".
There are plenty of alternatives, and to be honest, PHP has broken BC alot of
times in the last few versions (which is a good thing in my opinion, as long as
the language becomes cleaner/stricter).
Having all the files in lowercase makes them alot harder to read. Having a
custom autoloader function is slower and more complicated to get right, and just
makes code more ugly and harder to understand.
At the very least case sensitivity of the SPL autoloader should be configurable,
or available by the use of an extra suffix. I would love to see this in the new
5.4 release; shouldn't take more than a few lines of code.
------------------------------------------------------------------------
[2011-03-08 13:08:42] simon at systemparadox dot co dot uk
Why is this bug marked as bogus?
Even if spl_autoload itself isn't fixed, at the very least a version that does it correctly
could be added (although in this case it seriously could just be fixed by trying the correct case
first).
Implementing one in PHP is all very well, but that means that it's non-standard and likely
incompatible with what each programmer might expect. It's also slower.
------------------------------------------------------------------------
[2009-09-23 07:11:47] sjoerd@php.net
Trying both lowercased and original case could solve this without breaking backwards compatibility.
However, you could as well supply your own autoload function defined in PHP to solve this.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=49625
--
Edit this bug report at https://bugs.php.net/bug.php?id=49625&edit=1