Closed forfrt closed 8 years ago
You can't pass the sandbox a closure within an eval statement as it's not able to parse the passed closure so it can execute it within the sandbox environment.
This code would work:
$newSandbox->defineFunc("phpinfo", function(){
echo "hellow phpinfo";
});
$newSandbox->execute('<?php phpinfo(); ');
Also, notice you don't need to whitelist redefined functions, they are valid by default.
It says in the introduction that:
So I have tried using defineFunc like below:
But it seems doesn't work fine with
eval
statement. Furthermore, Could I have any method to inherit internal function other than totally rewrite it.Best regrads.