1.2.824. No Null For Native PHP Functions¶
Null is not acceptable anymore as an argument, for PHP native functions that require a non-nullable argument.
Until PHP 8.1, it was magically turned into an empty string.
<?php
$haystack = 'abc';
// $needle was omitted...
echo strpos($haystack, $needle);
?>
See also PHP RFC: Deprecate passing null to non-nullable arguments of internal functions.
1.2.824.2. Connex PHP features¶
1.2.824.2.1. Specs¶
Short name |
Php/NoNullForNative |
Rulesets |
All, Analyze, Changed Behavior, CompatibilityPHP81, Deprecated |
Exakat since |
2.2.5 |
PHP Version |
With PHP 8.1 and more recent |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |