From:             eric at wepay dot com
Operating system: OS X, CentOS
PHP version:      Irrelevant
Package:          Class/Object related
Bug Type:         Feature/Change Request
Bug description:Request: optional class name case-sensitivity

Description:
------------
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 
subdirectories).  

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, 
https://bugs.php.net/bug.php?id=26575&edit=1), 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.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=62655&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62655&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62655&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62655&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62655&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62655&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62655&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62655&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62655&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62655&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62655&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62655&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62655&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62655&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62655&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62655&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62655&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62655&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62655&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62655&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62655&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62655&r=mysqlcfg

Reply via email to