1.2.822. No Null For Index¶
Avoid using
nullvalue as an index in an array. PHP actually casts it to the empty string. This means that later, it might be impossible to find thenullin the list of keys.
<?php
$a = [];
$a[null] = 1;
print_r(array_keys($a));
// [''] empty string
?>
1.2.822.1. Connex PHP features¶
1.2.822.1.1. Suggestions¶
Always checks for null values. Given it then a valid value.
1.2.822.1.2. Specs¶
Short name |
Structures/NoNullForIndex |
Rulesets |
|
Exakat since |
2.5.3 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Medium |
Available in |