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

Description

The third argument of define() used to allow the creation of a case-insensitive global constant. The constant in the code would have been accessible with A or a, without distinction. This feature has been deprecated in PHP 7.3 and abandoned in PHP 8.0. For backward compatibility, the third argument is not reported as an error, but a warning. The constant is not case insensitive any way. Adding a fourth argument is a fatal error, and has no meaning.

Example

<?php

define('A', 'b', true);

?>

Solutions

  • Remove the third argument in the define() call.

In more recent PHP versions, this error message is now define(): Argument #3 ($case_insensitive) is ignored since declaration of case-insensitive constants is no longer supported.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See caseInsensitiveDefine.

Static Analysis

This error may be tracked down with the following static analysis rules: Constants/CaseInsensitiveConstants.