From c3dcdf28cb165aebdae57272e0122a769d7d0bfe Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 8 Dec 2018 15:42:06 +0700 Subject: [PATCH 1/2] handle fatal error via pre_sytem --- application/Config/Events.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/Config/Events.php b/application/Config/Events.php index 8b2fcd4a4e89..5efc5a51b395 100644 --- a/application/Config/Events.php +++ b/application/Config/Events.php @@ -30,6 +30,9 @@ Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); Events::on('pre_system', function () { + \ob_start(function ($buffer) { + return $buffer; + }); Services::toolbar()->respond(); }); } From 2593344e01dc939c2c27ca75d2740f696ac7c006 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 8 Dec 2018 17:40:40 +0700 Subject: [PATCH 2/2] testing env check buffer fatal error --- application/Config/Events.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/Config/Events.php b/application/Config/Events.php index 5efc5a51b395..97c732ab30a6 100644 --- a/application/Config/Events.php +++ b/application/Config/Events.php @@ -30,9 +30,12 @@ Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); Events::on('pre_system', function () { - \ob_start(function ($buffer) { - return $buffer; - }); + if (ENVIRONMENT !== 'testing') + { + \ob_start(function ($buffer) { + return $buffer; + }); + } Services::toolbar()->respond(); }); }