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) |
public function setErrorHandler($handler, $error_types = E_ALL)
{
$this->error_handler = $handler;
$this->error_handler_types = $error_types;
return $this;
}
/** * 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]; }); }