Open mustafaeida opened 3 years ago
Could you reproduce the issue or the captured picture?
And I can be easy to know where bugs are.
Same problem here. array_key_exists($str, $array)
where $str
is a PHPSandbox\SandboxedString (e.g. "date") produces an error: array_key_exists(): The first argument should be either a string or an integer
I tried to solve this problem through Modify a file this path vendor/corveda/php-sandbox/src/functions.php
line 17 return is_callable($strval) ? new SandboxedString($strval, $sandbox) : $value; to : return is_callable($strval) ? $strval : $value;
line 32 return new SandboxedString($value, $sandbox); to : return $value;
But I am not sure of the feasibility of this solution
For example :
$sandbox = new PHPSandbox; function test ($values) { return $values; } $sandbox->whitelistFunc(['test','dd']); $sandbox->allow_casting = true;
$result = $sandbox->execute(function(){ return test(['required','date', 'copy']); });
print_r( $result , );