On 12.09.2017 at 14:02, Christoph M. Becker wrote:

> 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/L6nCp>.
> 
> 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?

Thanks to everybody for their comments on this topic!

Frankly, I'm rather surprised about the large amount of objections – I
just hadn't expected that.  Now I'm pretty sure that a respective change
wouldn't get broad consensus, and in my opinion broad consensus is of
utmost importance regarding any change to php-src.  Therefore I will not
pursue the RFC. :)

Sorry for the noise, if you regard this discussion as such.  I, however,
found it insightful, and learned a lot about case-insensitive constants,
and I believe these lessions to be useful at least for me.

So, thanks again!

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to