{ register_shutdown_function(array($this, 'handleFatalError')); $this->handleFatalErrors = true; $this->originalDisplayErrors = ini_get('display_errors'); ini_set('display_errors', !$this->suppression); $this->step(); } protected function step() { if ($this->steps) { $step = array_shift($this->steps); if ($step['onErrorState'] === null || $step['onErrorState'] === $this->error) { try { call_user_func($step['callback'], $this); } catch (Exception $ex) { $this->lastException = $ex; throw $ex; } } $this->step(); } else { // Now clean up $this->handleFatalErrors = false; ini_set('display_errors', $this->originalDisplayErrors); } } } ErrorControlChain::$fatal_errors = E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR; if (defined('E_RECOVERABLE_ERROR')) { ErrorControlChain::$fatal_errors |= E_RECOVERABLE_ERROR; }