DELAPARRA
Index
Color
NL
Category: Regex flags

/e (Eval (deprecated))

Explained by Updated

What is /e (Eval (deprecated))?

/e (Eval (deprecated)): A historical PHP modifier that evaluated the replacement string as PHP code inside preg_replace(). The e modifier once made PHP's preg_replace() run the replacement as PHP code. It was deprecated in PHP 5.5 and removed in PHP 7.0, because it was a common source of remote code execution bugs. The danger was simple. If any part of the matched text came from a user, an attacker could craft input that ended up being executed on your server.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about /e (Eval (deprecated))

What should you keep in mind with /e (Eval (deprecated))?

If you find /e in old code, replace it with preg_replace_callback(). You pass a function that receives the match and returns the replacement, so the result is computed in normal PHP code and user input is only ever treated as data. Legacy code that still uses /e will not run on any supported PHP version, so finding it usually means the project needs a broader upgrade. That is worth knowing before you estimate the work.

At a glance

CategoryRegex flags
Explained by
Updated

More Regex flags terms

All terms starting with a number or symbol

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.