vanderlee / PHP-Expression

Simple and fast PHP expression parser, based on secure use of eval(). Supports both PHP 5.x long classnames and PHP 5.3 namespaces with short class names.
4 stars 0 forks source link

PHP-Expression

Version 1.0.2 Build Status

Simple and fast PHP expression parser, based on secure use of eval().

Compatible with PHP 7.1 and up.

Using eval() is evil()

This class tries to expose a subset of PHP functionality not by removing the bad features, but by explicitely allowing only the good features.

IF YOU FIND ANY (POTENTIAL) SECURITY ISSUE, PLEASE REPORT!

Since PHP-Expression uses eval(), it can also handle PHP syntax, including parenthesis, arithmetic, functions and more.

Things you are allowed to do

Things we've added

Things you should NOT be able to do

Things you cannnot do

Available functions

TODO

Disclaimers

Though this class has been tested and independantly reviewed by several people, I cannot make any absolute 100% guarantee that it cannot be hacked. If you find any potential security problem, please let us know.

Even though the Expression class itself is supposed to be secure, the return value may still be abused if your code does not check for validity. Only numbers can be returned, but if your code crashes on a number "666", the Expression class cannot and will not be able to protect you. Check for valid ranges.