Re: Deprecate and remove case-insensitive constants?
| From: | Niklas Keller | Date: | Tue, 12 Sep 2017 12:53:53 +0000 |
| Subject: | Re: Deprecate and remove case-insensitive constants? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100538@lists.php.net to get a copy of this message | ||
2017-09-12 14:02 GMT+02:00 Christoph M. Becker <cmbecker69@gmx.de>:
> Hi everybody!
>
> Usually constant identifiers are treated case-sensitive in PHP. This is
> always the case for constants defined via a
const declaration.
> However, define() allows to pass TRUE as third argument to define a
> case-insensitive constant. This feature appears to potentially result
> in confusion, and also causes bugs as shown in
> <https://bugs.php.net/74450>. See an example created by
> Nikita to see
> some probably unexpected behavior: <https://3v4l.org/L6nCpjÌÁ=G}•>¦uY\
> sù>.
>
> Even if these issues could be resolved, I still think allowing both
> case-sensitive and case-insensitive constant identifiers does more harm
> than good, so either case-sensitive or case-insensitive constant
> identifiers should be removed from the language. Since case-sensitive
> constant identifiers are already the default, and HHVM doesn't even
> support case-insensitive identifiers at all, I would suggest to remove
> case-insensitive constant identifiers.
>
> This could be implemented by triggering E_DEPRECATED whenever the third
> argument to define() is TRUE in PHP 7.3, and to remove this parameter
> altogether in PHP 8. Most likely some further simplification in the
> engine could be done then as well.
>
> Thoughts?
>
+1