From 4214954ea169e6cf6b9a7b2927dce892463c851c Mon Sep 17 00:00:00 2001 From: maTh Date: Sun, 21 Aug 2022 22:44:03 +0200 Subject: Improved: error page (#4465) * error page: true HTML page * error page: http500 erorr * error page: add CSP header * 'log.txt' replaced by LOG_FILENAME * use ADMIN_LOG * log.txt => LOG_FILENAME * error message: add * Docs created * delete: documentation on error message page * line break added * added: new line at the end * typo fixed * Update lib/lib_rss.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> * Update lib/lib_rss.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> * Minz HTTP 500 Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> --- lib/Minz/FrontController.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/Minz/FrontController.php') diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php index dea818a91..80fa5ce96 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -44,7 +44,7 @@ class Minz_FrontController { Minz_Request::forward ($url); } catch (Minz_Exception $e) { Minz_Log::error($e->getMessage()); - $this->killApp ($e->getMessage()); + self::killApp($e->getMessage()); } $this->dispatcher = Minz_Dispatcher::getInstance(); @@ -78,7 +78,7 @@ class Minz_FrontController { try { Minz_Log::error($e->getMessage()); } catch (Minz_PermissionDeniedException $e) { - $this->killApp ($e->getMessage ()); + self::killApp($e->getMessage()); } if ($e instanceof Minz_FileNotExistException || @@ -91,20 +91,21 @@ class Minz_FrontController { true ); } else { - $this->killApp($e->getMessage()); + self::killApp($e->getMessage()); } } } /** - * Permet d'arrĂȘter le programme en urgence - */ - private function killApp ($txt = '') { + * Kills the programme + */ + public static function killApp($txt = '') { + header('HTTP 1.1 500 Internal Server Error', true, 500); if (function_exists('errorMessageInfo')) { //If the application has defined a custom error message function - exit(errorMessageInfo('Application problem', $txt)); + die(errorMessageInfo('Application problem', $txt)); } - exit('### Application problem ###<br />' . "\n" . $txt); + die('### Application problem ###<br />' . "\n" . $txt); } private function setReporting() { -- cgit v1.2.3