From 99eaf5409ed26a7b8f469f33ccbf9c7778869b3a Mon Sep 17 00:00:00 2001 From: blackcoder87 Date: Sun, 12 Apr 2020 14:28:51 +0200 Subject: [PATCH] Fix "Trying to access array offset on value of type null" which occured under PHP 7.4 when for example a layout called getMenu() with an menu id that doesn't exist. In this case an empty string will be returned or in other words no menu. --- application/libraries/Ilch/Layout/Helper/Menu/Mapper.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/application/libraries/Ilch/Layout/Helper/Menu/Mapper.php b/application/libraries/Ilch/Layout/Helper/Menu/Mapper.php index 7be8fcd5d..72edc048b 100644 --- a/application/libraries/Ilch/Layout/Helper/Menu/Mapper.php +++ b/application/libraries/Ilch/Layout/Helper/Menu/Mapper.php @@ -1,6 +1,6 @@ execute() ->fetchAssoc(); - $menu->setId($menuRow['id']); - $menu->setTitle($menuRow['title']); + if (!empty($menuRow)) { + $menu->setId($menuRow['id']); + $menu->setTitle($menuRow['title']); + } return $menu; }