Leaving a call to eval() with user supplied input, no matter how well filtered, seems like way too big of a risk.
Leaving a call to eval() with user supplied input, no matter how well filtered, seems like way too big of a risk.
Sounds like they should just not be eval()ing user input regardless of how much sanitization they throw at it.
https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm
Speaking of parsing simplicity and software design in general, you've coincidentally found a great example of how not to (ab)use OOP... one line of actual work wrapped in a dozen lines of boilerplate and replicated across multiple files with tiny variations:
https://github.com/ircmaxell/php-math-parser/tree/master/lib...
To put things into perspective, a precedence-climber for 13 levels of precedence from C's grammar, including a tokeniser, fits comfortably in <300 LoC of C, the bulk of that being the tokeniser. PHP's higher level nature (especially around string handling) would probably make a corresponding implementation even smaller.
This seems to disprove that, no?
Installing and configuring your environment to your needs should be entry level stuff for a developer, so what was the point of your reply?