1.2.240. Constants With Strange Names¶
List of constants being defined with names that are incompatible with PHP standards.
Constants names are valid when they satisfy the following regex : ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$
<?php
// Define a valid PHP constant
define('ABC', 1);
const ABCD = 2;
// Define an invalid PHP constant
define('ABC!', 1);
echo defined('ABC!') ? constant('ABC!') : 'Undefined';
// Const doesn't allow illegal names
?>
See also PHP Constants.
1.2.240.1. Connex PHP features¶
1.2.240.1.1. Suggestions¶
Rename constants to be valid constants
Adopt a naming conversion scheme, to translate names from an incompatible source to PHP’s standard (and back).
1.2.240.1.2. Specs¶
Short name |
Constants/ConstantStrangeNames |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Available in |