A function is called that current PHP versions no longer have
What it finds
A call of a function that PHP 5.4 to PHP 8 removed, such as each, create_function, the mysql_* and ereg* families, mcrypt_* or money_format: on a current PHP the call is a fatal error. A file that declares a function of the same name, or asks function_exists about it, provides a replacement and is left alone.
From the rule's source, removed_function.rs.
<?phpfunction legacy($array, $db){ while (list($k, $v) = each($array)) {tx0 reports: each was removed in PHP 8.0 echo $k, $v; } $r = mysql_query('SELECT 1', $db);tx0 reports: mysql_query was removed in PHP 7.0 if (function_exists('money_format')) { echo money_format('%i', 3); } return $r;} function create_function_like(){ return create_function('$a', 'return $a;');tx0 reports: create_function was removed in PHP 8.0} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/php:removed-function" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/php:removed-function] reason="..."tx0 explain tx0/php:removed-function shows the same in the terminal. Found a false positive? Report it.