setValidationErrorHandler() public method

This function sets the sandbox validation Error handler. The handler accepts the thrown Error and the sandbox instance as arguments. If the error handler does not handle validation errors correctly then the sandbox's security may become compromised!
public setValidationErrorHandler ( callable $handler )
$handler callable Callable to handle thrown validation Errors
Exemplo n.º 1
0
 /**
  * Test whether sandbox custom validation error handler intercepts validation Errors
  */
 public function testCustomValidationErrorHandler()
 {
     $this->expectException('PHPSandbox\\Error');
     $this->sandbox->setValidationErrorHandler(function ($error) {
         throw $error;
     });
     $this->sandbox->execute(function () {
         test2();
     });
 }