/** * Handle the shutdown of the system, recording any fatal errors. */ public function handler() { $err = error_get_last(); if (!isset($err['type']) || !in_array($err['type'], [E_USER_ERROR, E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING])) { return; } $this->viewMessageBox->setTitle('Fatal Error'); $this->viewMessageBox->addContent(['p', ['class' => 'Description'], 'This is an error that we were unable to handle. Please tell us any information that could help us ' . 'avoid this error in the future. Useful information such as the date, time and what you were doing ' . 'when the error occurred should help us fix this.']); if (!empty($this->email)) { $this->viewMessageBox->addContent(['div', ['class' => 'Contact'], 'Contact: ' . $this->email]); } if ($this->showError) { $this->viewError->set($err); $this->viewMessageBox->addContent($this->viewError->get()); } $this->writer->write($this->viewMessageBox->get()); $this->response->setStatus(500); $this->response->setBody((string) $this->writer); $this->response->send(); }
/** * If the error has not been set then it throws. * * @expectedException LogicException */ public function testUnsetError() { $object = new Error(); $object->get(); }