We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please I don't know why this not working
<?php require_once 'vendor/autoload.php'; use PHPSandbox\PHPSandbox; function test($string){ return 'Hello ' . $string; } class Server { public function sendMessage($message) { echo "Sending message: " . $message; } } $Server = new Server(); $sandbox = new PHPSandbox(); $sandbox->whitelistClass("Server"); $sandbox->whitelistVar("Server"); $sandbox->defineVars(['Server']); $result = $sandbox->execute('<?php echo $Server->sendMessage("ping google.com"); ?>'); var_dump($result);
Fatal error: Uncaught PHPSandbox\Error: Cannot define unnamed variable! in /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php:7195 Stack trace: #0 /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php(2774): PHPSandbox\PHPSandbox->validationError('Cannot define u...', 203, NULL, '') #1 /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php(2792): PHPSandbox\PHPSandbox->defineVar(0, 'Server') #2 /data/data/com.termux/files/home/php/bota/test.php(21): PHPSandbox\PHPSandbox->defineVars(Array) #3 {main} thrown in /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php on line 7195
The text was updated successfully, but these errors were encountered:
Fixed
Changed
$sandbox->defineVars(['Server']);
To
$sandbox->defineVars(['Server' => $Server]);
Sorry, something went wrong.
No branches or pull requests
Please I don't know why this not working
Fatal error: Uncaught PHPSandbox\Error: Cannot define unnamed variable! in /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php:7195
Stack trace:
#0 /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php(2774): PHPSandbox\PHPSandbox->validationError('Cannot define u...', 203, NULL, '')
#1 /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php(2792): PHPSandbox\PHPSandbox->defineVar(0, 'Server')
#2 /data/data/com.termux/files/home/php/bota/test.php(21): PHPSandbox\PHPSandbox->defineVars(Array)
#3 {main}
thrown in /data/data/com.termux/files/home/php/bota/vendor/corveda/php-sandbox/src/PHPSandbox.php on line 7195
The text was updated successfully, but these errors were encountered: