|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49640 Feature request: spl_autoload_cs
Submitted: 2009-09-23 10:05 UTC Modified: 2020-06-10 09:34 UTC
Avg. Score:4.6 ± 0.7
Reproduced:7 of 7 (100.0%)
Same Version:3 (42.9%)
Same OS:5 (71.4%)
From: jo at feuersee dot de Assigned:
Status: Duplicate Package: SPL related
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID: None
 [2009-09-23 10:05 UTC] jo at feuersee dot de
This is related to #49625

Ok I agree that spl_autoload() won't be touched because of BC (Seems the convention to lowercase all filenames has been borrowed from Java and ppl are actually using it).

How about a case sensitive function spl_autoload_cs() then? It should behave excactly like spl_autoload() except that it skips the lowercasing stuff. Projects using a case sensitive naming convention (PEAR, Zend Framework, ...) can unregister the default spl_autoload() and register spl_autoload_cs() and it will work.

I am aware that it is possible to write an own callback in PHP. The problem is that you can't write the callback once and then put it in your codebase because the callback is the glue between your script and the codebase.

I do a lot of scripting PHP on the CLI and am tired of duplicating my callback function code over and over again just to make sure the script will work with a case sensitive design paradim.

Reproduce code:
 * proposed usage of new feature spl_autoload_cs()


// executing a PEAR class would work now
$phpbin = System::which('php');



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 11:15 UTC]
-Package: Feature/Change Request +Package: SPL related
 [2012-09-07 17:36 UTC] eugeny dot p at gmail dot com
It would make sense to make spl_autoload_cs similar to spl_autoload_extensions
spl_autoload_cs(bool CaseSensitive) - false is default

So usage is going to be:

> # To make it case sensitive
> spl_autoload_cs(true);
> spl_autoload_register();

> # Default
> spl_autoload_cs(false);
> spl_autoload_register();
> # Or just 
> spl_autoload_register();
 [2020-06-10 09:34 UTC]
-Status: Open +Status: Duplicate
 [2020-06-10 09:34 UTC]
Closing this as a duplicate of the more general bug #53065.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Mar 23 05:03:38 2023 UTC