PHP 7.3: Deprecate case-insensitive constants

Version7.3
TypeDeprecation

PHP's define() function has a feature that lets you declare a constant in a case-insensitive way. You have to explicitly declare the constant case-sensitive by passing the third parameter of the function as true. This is not enabled by default, and it's not definitely not consistent with the other approaches to declare constants such as with the const keyword.

define('Foo', 'Bar', true);

The above code will throw a deprecation notice:

Deprecated: define(): Declaration of case-insensitive constants is deprecated in ...

Furthermore, when you try to access constants that are declared case-insensitive (e.g as FOO), you will see a quite helpful warning as well:

Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "Foo"

Backwards compatibility impact

You will have to search for your code base that declares case-insensitive constants, and where they are used, and fix them to be consistent everywhere. It is highly unlikely that you will have any problems with this, because you had to explicitly declare a constant case-insensitive. I could not search GitHub for existing code because they don't allow regular expressions of any sort. However, for Drupal and Wordpress at least (two quite old and mature projects in PHP), there are no case-insensitive constants.

RFC Externals.io discussion Implementation