php.net |  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
Votes:7
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jo at feuersee dot de
New email:
PHP Version: OS:

 

 [2009-09-23 10:05 UTC] jo at feuersee dot de
Description:
------------
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:
---------------
<?php
/**
 * proposed usage of new feature spl_autoload_cs()
 */

spl_autoload_unregister('spl_autoload');
spl_autoload_register('spl_autoload_cs');

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

?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 11:15 UTC] jani@php.net
-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] nikic@php.net
-Status: Open +Status: Duplicate
 [2020-06-10 09:34 UTC] nikic@php.net
Closing this as a duplicate of the more general bug #53065.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC