{
function call($request)
{
- $previous = set_error_handler(array($this, 'error_handler'));
+ $this->previous_error_handler = set_error_handler(array($this, 'error_handler'));
register_shutdown_function(array($this, 'shutdown_handler'), $request);
try {
if (!$this->next)
error_log($exception);
$response = new IPF_HTTP_Response_ServerError($request, $exception);
}
- set_error_handler($previous);
+ if ($this->previous_error_handler)
+ set_error_handler($previous);
+ else
+ restore_error_handler();
return $response;
}
{
if (error_reporting() & $errno)
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
+
+ if ($this->previous_error_handler)
+ call_user_func($this->previous_error_handler, $errno, $errstr, $errfile, $errline);
}
function shutdown_handler($request)