PHP

PHP

Made by DeepSource

Undefined function call detected PHP-E1000

Bug risk
Critical

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;
    }
}