1.2.1445. Wrong Type For Native PHP Function¶
This analysis reports calls to a PHP native function with a wrongly typed value.
<?php
// valid calls
echo exp(1);
echo exp(2.5);
// invalid calls
echo exp("1");
echo exp(array(2.5));
// valid call, but invalid math
// -1 is not a valid value for log(), but -1 is a valid type (int) : it is not reported by this analysis.
echo log(-1);
?>
1.2.1445.1. Suggestions¶
Set the code to the valid type, when calling a PHP native function
1.2.1445.2. Specs¶
Short name |
Php/WrongTypeForNativeFunction |
Rulesets |
|
Exakat since |
2.1.5 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |