From 2e08a63aa70e5d3b57a9744b84aa54ce134527bf Mon Sep 17 00:00:00 2001 From: Maarten Date: Thu, 13 Feb 2020 19:05:48 +0100 Subject: [PATCH] Fix debug setting exception handler --- resources/views/errors/500.twig | 2 +- src/Runtime/Config/Env.php | 4 ++-- src/Runtime/Exceptions/ExceptionHandler.php | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/views/errors/500.twig b/resources/views/errors/500.twig index 77168b2..4bbbdd7 100644 --- a/resources/views/errors/500.twig +++ b/resources/views/errors/500.twig @@ -1 +1 @@ -An error has occured \ No newline at end of file +Er is helaas iets mis gegaan. Probeer het opnieuw \ No newline at end of file diff --git a/src/Runtime/Config/Env.php b/src/Runtime/Config/Env.php index 49a4376..5f6db01 100644 --- a/src/Runtime/Config/Env.php +++ b/src/Runtime/Config/Env.php @@ -27,8 +27,8 @@ class Env { private static function filter(string $result) { switch ($result) { - case filter_var($result, FILTER_VALIDATE_BOOLEAN): - return (bool) $result; + case in_array($result, ['true', 'false']): + return filter_var($result, FILTER_VALIDATE_BOOLEAN); break; case filter_var($result, FILTER_VALIDATE_INT): return (int) $result; diff --git a/src/Runtime/Exceptions/ExceptionHandler.php b/src/Runtime/Exceptions/ExceptionHandler.php index 8af58cd..e4ec7da 100644 --- a/src/Runtime/Exceptions/ExceptionHandler.php +++ b/src/Runtime/Exceptions/ExceptionHandler.php @@ -8,6 +8,7 @@ use Whoops\Handler\PlainTextHandler; use Whoops\Run; use Whoops\Handler\PrettyPageHandler; use Whoops\Util\Misc; +use function DI\value; class ExceptionHandler { @@ -40,7 +41,7 @@ class ExceptionHandler { { self::$handler = new Run(); - $debug = true; //TODO: Get from config + $debug = env('debug'); if($debug === false) { self::$handler->pushHandler(function() {