Req #49640 [Com]: Feature request: spl_autoload_cs

From: Date: Fri, 07 Sep 2012 17:36:31 +0000
Subject: Req #49640 [Com]: Feature request: spl_autoload_cs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-173241@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=49640&edit=1 ID: 49640 Comment by: eugeny dot p at gmail dot com Reported by: jo at feuersee dot de Summary: Feature request: spl_autoload_cs Status: Open Type: Feature/Change Request Package: SPL related Operating System: Linux PHP Version: 5.3.0 Block user comment: N Private report: N New Comment: 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(); Previous Comments: ------------------------------------------------------------------------ [2009-09-23 10:05:42] 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'); ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=49640&edit=1

« previous php.bugs (#173241) next »