From 031ed45cd09814f5ab3c03a235b4511994911683 Mon Sep 17 00:00:00 2001 From: Pusparaj <10107534+RaazPuspa@users.noreply.github.com> Date: Wed, 4 Dec 2019 03:45:29 +0545 Subject: [PATCH] Handle empty log array while preparing data to display (#214) PHP 7.4 throws an error while trying to access array offset on value of type bool returned by reset() method for empty log --- src/controllers/LogViewerController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/LogViewerController.php b/src/controllers/LogViewerController.php index 70f709f..44e5338 100644 --- a/src/controllers/LogViewerController.php +++ b/src/controllers/LogViewerController.php @@ -72,7 +72,7 @@ public function index() return $data; } - if (is_array($data['logs'])) { + if (is_array($data['logs']) && count($data['logs']) > 0) { $firstLog = reset($data['logs']); if (!$firstLog['context'] && !$firstLog['level']) { $data['standardFormat'] = false;