php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53065 Allow spl_autoload to be case sensitive on *nix
Submitted: 2010-10-14 13:33 UTC Modified: 2020-06-10 09:37 UTC
Votes:88
Avg. Score:4.8 ± 0.5
Reproduced:81 of 85 (95.3%)
Same Version:43 (53.1%)
Same OS:45 (55.6%)
From: staff at pro-unreal dot de Assigned:
Status: Wont fix Package: SPL related
PHP Version: 5.3.3 OS: Ubuntu Linux 10.04
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: staff at pro-unreal dot de
New email:
PHP Version: OS:

 

 [2010-10-14 13:33 UTC] 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

Patches

spl_autoload_case_sensitive (last revision 2010-12-27 14:34 UTC by marc at easen dot co dot uk)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-04 10:23 UTC] chris at cmbuckley dot co dot uk
See Bug #49852 for the same bug in the 5.2 branch.
 [2020-06-10 09:37 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2020-06-10 09:37 UTC] nikic@php.net
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).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 06:01:28 2024 UTC