/** * @param \framework\errorHandler\ErrorHandler $errorHandler */ public function update(\framework\errorHandler\ErrorHandler $errorHandler) { $e = $errorHandler->getLastError(); $lines = array(); $lines[] = '<strong>' . get_class($e) . ' with the following message :</strong><br />'; $lines[] = $e->getMessage() . '<br />'; $lines[] = 'in file <em>' . $e->getFile() . '</em> on line <em>' . $e->getLine() . '</em><br />'; $stack = $e->getTrace(); $code = $this->codeSample($e->getFile(), $e->getLine()); $lines = array_merge($lines, $this->formatTrace($stack), $code); $rc = implode('<br />' . PHP_EOL, $lines); $response = $this->getContainer()->getHttpResponse()->status(500); if (ini_get('display_errors')) { $response->set($rc); } else { $response->set('Oops! An error occured!'); } $this->viewSetGlobal('layout', false); $response->stopProcess(); }
<?php //ini_set('display_errors',0); /** * Application entry point. */ require_once __DIR__ . '/../framework/Loader.php'; \Framework\ErrorHandler\ErrorHandler::loadErrorHandler(); Loader::addNamespacePath('Blog\\', __DIR__ . '/../src/Blog'); $app = new \Framework\Application(__DIR__ . '/../app/config/config.php'); $app->run();