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

Run sandbox PHP code on multiple PHP versions #9

Closed jasondavis closed 7 years ago

jasondavis commented 7 years ago

I came across this online PHP sandbox app similar to this project (closed source and not available except as an online service) http://sandbox.onlinephpfunctions.com/

I noticed it allows to run the PHP code on up to 62-63 different PHP versions!

I am curious, would it be difficult to allow a project like this to work across multiple PHP versions? I realize it would likely require the hosting server to have all the available PHP versions installed but was just curious if it might be easy to add support for this project to work across multiple versions when available?

fieryprophet commented 7 years ago

There's isn't any particular reason this project couldn't be run under multiple PHP versions, but it will be limited by the number of versions supported by its upstream libraries such as PHP-Parser. The site you linked to is more a wrapper around whatever sandboxing mechanism they are using, whereas this library is for runtime sandboxing of PHP code and has a bit of a different focus. For example, this library supports redefining (from the executing code's perspective) things like internal PHP classes and functions and caching the rewritten code, so its focus is more of intercepting potentially malicious code, not being an online REPL (although it can help facilitate that.)