Call to function htmlspecialchars() with incorrect case: htmlSpecialChars
29 var_dump(Version::php72());
30 var_dump(Version::PHP73());
31
32 var_dump(htmlSpecialChars('<strong>Foo</strong>'));33 }
34}
Function Utils\GroupUse\php_81 not found
21 *
22 */
23 var_dump(php_80());
24 var_dump(php_81()); // invalid: function doesn't exist25
26 var_dump(PHP_74);
27 var_dump(PHP_73); // invalid: constant doesn't exist
Description
A function has been called, but not defined. This will result in a run time fatal error.
This issue can be raised for any of the following cases:
- Function is not defined.
- PHP is case-sensitive, so make sure the function case is correct.
Bad practice
class User
{
public function getName()
{
$lower = make_string_lowercase('JOHN DOE'); // function doesn't exist
return $lower;
}
}
class Utility
{
public function sanitizeText()
{
$text = htmlSpecialChars("<a href='/about'>About</a>"); // incorrect function case
return $text;
}
}
Recommended
function make_string_lowercase($str)
{
return strtolower($str);
}
class User
{
public function getName()
{
$lower = make_string_lowercase('JOHN DOE');
return $lower;
}
}
class Utility
{
public function sanitizeText()
{
$text = htmlspecialchars("<a href='/about'>About</a>");
return $text;
}
}