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: -
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: Open Package: SPL related
PHP Version: 5.3.3 OS: Ubuntu Linux 10.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC