phanalist

E0059: Dynamic eval or assert

In plain English: eval() runs a string as PHP code. A string-based assert() can do the same. If any part of the string comes from a request, an attacker may be able to run code.

Why it matters: Code built at runtime is hard to validate and can turn data into executable code.

Bad

return eval($code);

assert('$value > 0');

Good

$callback = $handlers[$name] ?? null;

if ($callback !== null) {
    return $callback();
}

assert($value > 0);

What the rule checks

When it does not report

How to fix

Model limits

Configuration

E0059 has no configuration options and is enabled by default.