safer eval()
PHP Class
about
introduction and warning
restrictions
elements permitted by default
download
sourceforge.net project page
demo
hacking sandbox
contact
About this class
This libray attempts to secure eval() in order to allow for the following kind of scripting:
- user-controlled
- over-the-web
- focused on variable-handling
- independent of third-party parsers or interpreters
To achieve this, a big part of PHP's functionality has been restricted, but these limits are configurable.
How does it work?
Safer eval() checks the user's code for (or against) the following aspects:
- Syntax
- Shell-execution
- Variable variable names
- Variable function names
- PHP Tokens
- Variable names
- Function names
WARNING!
- Using eval() on user scripts is an extremely high security risk.
- Safer eval() is experimental.
- Safer eval() is intended for experienced developers.
- Safer eval() has not been tested in production environemnts.