setErrorHandler() public method

This function sets the sandbox error handler and the handled error types. The handler accepts the error number, the error message, the error file, the error line, the error context and the sandbox instance as arguments. If the error handler does not handle errors correctly then the sandbox's security may become compromised! }, E_ALL); //ignore all errors, INSECURE
public setErrorHandler ( callable $handler, integer $error_types = E_ALL )
$handler callable Callable to handle thrown Errors
$error_types integer Integer flag of the error types to handle (default is E_ALL)
コード例 #1
0
 /**
  * Test whether sandbox custom error handler intercepts errors
  */
 public function testCustomErrorHandler()
 {
     $this->expectException('Exception');
     $this->sandbox->setErrorHandler(function ($errno, $errstr) {
         throw new \Exception($errstr);
     });
     $this->sandbox->execute(function () {
         $a[1];
     });
 }