Req #62655 [Opn->Sus]: Request: optional class name case-sensitivity
| From: | cmb@php.net | Date: | Tue, 07 Apr 2020 10:15:08 +0000 |
| Subject: | Req #62655 [Opn->Sus]: Request: optional class name case-sensitivity | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226450@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62655&edit=1
ID: 62655
Updated by: cmb@php.net
Reported by: eric at wepay dot com
Summary: Request: optional class name case-sensitivity
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Class/Object related
Operating System: OS X, CentOS
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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] <https://www.php.net/mailing-lists.php#internals>
Previous Comments:
------------------------------------------------------------------------
[2012-07-24 23:51:54] eric at wepay dot com
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 this bug report at https://bugs.php.net/bug.php?id=62655&edit=1