Req #53065 [Opn->Wfx]: Allow spl_autoload to be case sensitive on *nix

From: Date: Wed, 10 Jun 2020 09:37:32 +0000
Subject: Req #53065 [Opn->Wfx]: Allow spl_autoload to be case sensitive on *nix
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227396@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53065&edit=1 ID: 53065 Updated by: nikic@php.net Reported by: staff at pro-unreal dot de Summary: Allow spl_autoload to be case sensitive on *nix -Status: Open +Status: Wont fix Type: Feature/Change Request Package: SPL related Operating System: Ubuntu Linux 10.04 PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: I'll go ahead and mark this as "won't fix". Realistically, the ecosystem has moved away from spl_autoload() a long time ago, in conjunction with the rise of composer. I don't think it makes sense to extend this API any more at this point in time. If anything we should just deprecate it (though there's not much point to that either). Previous Comments: ------------------------------------------------------------------------ [2020-06-10 09:34:18] nikic@php.net Related To: Bug #49640 ------------------------------------------------------------------------ [2011-01-04 10:23:56] chris at cmbuckley dot co dot uk See Bug #49852 for the same bug in the 5.2 branch. ------------------------------------------------------------------------ [2010-10-14 13:33:44] staff at pro-unreal dot de Description: ------------ I Opened This because #48129 is set to "won't fix". But this affects major frameworks i.e. (ZendFramework, FLOW3).It would be nice to tell spl_autoload() not to lowercase all filenames so that these framworks can benefit from its performance. To stay backwards compatible this could be done via php.ini or a function call. I would suggest spl_autoload_casesensitive in php.ini or a method spl_autoload_casesensitive(bool $flag); Another more compatible option could be handling this inside of spl_autoload(). Check for unmodified case first (i.e. Zend/Db/Adapter/Abstract.php) and if this is not available try lowercased (i.e. zend/db/adapter/abstract.php) This Solutions won't break BC! Test script: --------------- <?php namespace Test; use Zend\Controller; slp_autoload_casesensitive(true); spl_autoload_extensions('.php'); spl_autoload_register(); // this should load from correct ZF path: Zend/Controller/Front.php; $request = new Controller\Front(); Expected result: ---------------- Class should be loaded from Zend/Controller/Front.php in include path Actual result: -------------- Class is always loaded from zend/controller/front.php in include path ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=53065&edit=1

« previous php.bugs (#227396) next »