Constant Redefinition

no-email (Damien Seguy), Damien Seguy
Thu, 26 Dec 2024 00:00:00 +0000

It is possible to specify several identical global constant definition: PHP reports a warning, and ignores the second definitions.
On the other hand, a duplicate class constant definition is a fatal error, and fails the compilation phase.
The difference of behavior may be linked to the level of consistence that PHP can achieve: global constants needs an application wide check for name unicity, while class constants can be checked while compiling a class.
Yet, it might be worth looking into leveling both errors, to avoid hard to find bugs.