From a999046882dbe8023ac106cce86f1962a1e3e52b Mon Sep 17 00:00:00 2001 From: Jan Chren Date: Thu, 4 Sep 2014 00:27:30 +0200 Subject: [PATCH 1/3] removed unused functions --- system/src/Grav/Common/Debugger.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index ee32ead766..456403eb55 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -42,15 +42,14 @@ public function init() ini_set('display_errors', true); } - if ($mode == strtolower('detect')) { + if ($mode === 'detect') { TracyDebugger::$productionMode = self::DETECT; - } elseif ($mode == strtolower('production')) { + } elseif ($mode === 'production') { TracyDebugger::$productionMode = self::PRODUCTION; } else { TracyDebugger::$productionMode = self::DEVELOPMENT; } - } } From 144d64e0c8931b31d66eb7143f1ea39fc085a26d Mon Sep 17 00:00:00 2001 From: Jan Chren Date: Thu, 4 Sep 2014 00:29:45 +0200 Subject: [PATCH 2/3] detect mode only if debugger enabled --- system/src/Grav/Common/Debugger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index 456403eb55..03324b74f5 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -28,7 +28,6 @@ public function init() /** @var Config $config */ $config = $grav['config']; - $mode = $config->get('system.debugger.mode'); TracyDebugger::$logDirectory = $config->get('system.debugger.log.enabled') ? LOG_DIR : null; TracyDebugger::$maxDepth = $config->get('system.debugger.max_depth'); @@ -42,6 +41,7 @@ public function init() ini_set('display_errors', true); } + $mode = $config->get('system.debugger.mode'); if ($mode === 'detect') { TracyDebugger::$productionMode = self::DETECT; } elseif ($mode === 'production') { From cc81ea7e3eb845c9cac43b908ee18415a44807a4 Mon Sep 17 00:00:00 2001 From: Jan Chren Date: Thu, 4 Sep 2014 02:50:27 +0200 Subject: [PATCH 3/3] disable display_errors in production environment --- system/src/Grav/Common/Debugger.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index 03324b74f5..3ffbd50b0b 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -37,11 +37,12 @@ public function init() TracyDebugger::$strictMode = true; } + $mode = $config->get('system.debugger.mode'); + if (function_exists('ini_set')) { - ini_set('display_errors', true); + ini_set('display_errors', !($mode === 'production')); } - $mode = $config->get('system.debugger.mode'); if ($mode === 'detect') { TracyDebugger::$productionMode = self::DETECT; } elseif ($mode === 'production') {