From 3affca5a20a1719e77ea1ac338479196763dc2c5 Mon Sep 17 00:00:00 2001 From: Markus Milkereit Date: Fri, 1 Sep 2023 10:27:19 +0200 Subject: [PATCH] error handling imprioved for PHP 8.x compatability --- src/EventListener/ParseFrontendTemplateListener.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/EventListener/ParseFrontendTemplateListener.php b/src/EventListener/ParseFrontendTemplateListener.php index 1f8dddd..649fd40 100644 --- a/src/EventListener/ParseFrontendTemplateListener.php +++ b/src/EventListener/ParseFrontendTemplateListener.php @@ -18,10 +18,13 @@ class ParseFrontendTemplateListener public function __invoke(string $buffer, string $templateName, FrontendTemplate $template): string { if (TL_MODE == 'BE' && $templateName != 'ce_html') { - if (!$GLOBALS['objPage']) { + if (!isset($GLOBALS['objPage']) || !$GLOBALS['objPage']) { $a = ArticleModel::findById(Input::get("id")); $b = PageModel::findByPk($a->pid); - $GLOBALS['objPage'] = PageModel::findByPk($b->trail[0]); + + if($b->trail) { + $GLOBALS['objPage'] = PageModel::findByPk($b->trail[0]); + } } $objIt = new InsertTags(); $buffer = $objIt->replace($buffer, true);