A preg_replace pattern uses the removed modifier that evaluates the replacement as code

tx0/php:regex-eval-modifierdefaulterrorsecurity/injectiondepth fastbug, security, cwe-95

What it finds

preg_replace('/(\w+)/e', ...): the e modifier evaluated the replacement as PHP code, with the matched text in it, which made every such call a way to run injected code. PHP 7 removed it, and the call now fails; preg_replace_callback does the job.

From the rule's source, regex_eval_modifier.rs.

Example from the rule's tests
<?phpfunction upper($s){    $a = preg_replace('/(\w+)/e', 'strtoupper("$1")', $s);tx0 reports: this pattern uses the e modifier    $b = preg_replace('/(\w+)/i', '$1', $s);    return $a . $b;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/php:regex-eval-modifier" = "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:regex-eval-modifier] reason="..."

tx0 explain tx0/php:regex-eval-modifier shows the same in the terminal. Found a false positive? Report it.