|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62655 Request: optional class name case-sensitivity
Submitted: 2012-07-24 23:51 UTC Modified: 2020-04-07 10:15 UTC
Avg. Score:3.0 ± 1.6
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: eric at wepay dot com Assigned:
Status: Suspended Package: Class/Object related
PHP Version: Irrelevant OS: OS X, CentOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
47 - 24 = ?
Subscribe to this entry?

 [2012-07-24 23:51 UTC] eric at wepay dot com
It would be beneficial in more complex applications to be able to opt-in to case 
sensitive class names. It's very common to put classes in their own files where 
the filename matches the class name (namespaced classes often residing in 

However, the lack of case-sensitivity makes it easy to create very rare and 
subtle bugs in applications: development is often done on case-insensitive 
filesystems, and deployed to a case-sensitive production environment. While the 
obvious answer here is to develop in an environment identical to production, 
it's often impractical if not impossible to use a case-sensitive filesystem on a 
dev machine. Other behavior in autoloaders can have similar harmful effects, 
especially when new code paths cause scripts or classes to be loaded in a 
different order.

I am not proposing that this become the default behavior, as it would obviously 
break countless applications. It should also not modify 
__autoload/spl_autoload_register in any way. It would be nice to be able to 
selectively enable this via php.ini:

; Enable class name case sensitivity
; 0 (default): class names are case-insensitive
; 1: class names are case-insensitive, but using a class name in a way different 
from its declaration will issue an E_STRICT warning including file and line of 
class name misuse
; 2: class names are case-sensitive. "class a {}" and "class A {}" can coexist; 
"A::foo()" and "a:foo()" are two separate calls
class_name_sensitivity = 0

I'm aware this has been discussed before (as early as 2003,, however web app development has 
come a long way in nearly a decade and I think it's worth re-examining this, 
especially since it should be possible to do in a non-breaking manner.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-07 10:15 UTC]
-Status: Open +Status: Suspended
 [2020-04-07 10:15 UTC]
This feature appears to be controversial (because INI settings
affecting language behavior are), so would require discussion on
the internals mailing list[1].  Feel free to start the discussion
there; for the time being, I'm suspending this ticket.

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 07:01:29 2024 UTC