Corveda / PHPSandbox

A PHP-based sandboxing library with a full suite of configuration and validation options.
https://phpsandbox.org
Other
220 stars 46 forks source link

Is it possible to redefine eval #4

Closed forfrt closed 8 years ago

forfrt commented 8 years ago

I need to log every arguments before eval statement is executed. I know eval is a language construct, but still cant find a way to rewrite it.

The attempts gives me error message as below: eval()'d code(3) : eval()'d code on line 1

So the question is, is it possible to rewrite a keyword or could I place a filter before eval is executed.

fieryprophet commented 8 years ago

Interesting question, let me look at the code. I may be able to reorder the logic in a way that allows redefining certain keywords as functions.

fieryprophet commented 8 years ago

I haven't found a way to do this without causing some odd parser issues, unfortunately.