preg_replace with the /e modifier
Why it matters
The /e modifier evaluated the replacement as PHP code. It was removed in PHP 7, so code that still uses it is dangerous on old servers and broken on new ones.
$out = preg_replace('/(\w+)/e', 'strtoupper("$1")', $text);
$out = preg_replace_callback('/(\w+)/', fn($m) => strtoupper($m[1]), $text);
How to fix
The /e modifier runs code. Use preg_replace_callback() instead.
Scan my code
Scan my code β
Paste a file and PHP Safe points to every line that matches this rule.