From 409f8f737895ab0fa27b8203b9d70e0e249da96a Mon Sep 17 00:00:00 2001
From: Thomas Hohn <thomas@hohn.dk>
Date: Tue, 7 Feb 2023 21:01:14 +0100
Subject: [PATCH] [BUGFIX] Fix PHP 8 warning in AbstractMenuContentObject

Added Null coalescing operator, when value of
$this->mconf['sectionIndex.']['type'] is used.

Resolves: #99866
Releases: main, 11.5
Change-Id: I0b6969b353bf7a55b640f71ced64c06c7539cf27
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77840
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Classes/ContentObject/Menu/AbstractMenuContentObject.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
index 5a9be41ca04b..80982c1a81f2 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
@@ -1809,9 +1809,10 @@ abstract class AbstractMenuContentObject
                 );
             }
             if (is_array($row)) {
-                if ($this->mconf['sectionIndex.']['type'] !== 'all') {
+                $sectionIndexType = $this->mconf['sectionIndex.']['type'] ?? '';
+                if ($sectionIndexType !== 'all') {
                     $doIncludeInSectionIndex = $row['sectionIndex'] >= 1;
-                    $doHeaderCheck = $this->mconf['sectionIndex.']['type'] === 'header';
+                    $doHeaderCheck = $sectionIndexType === 'header';
                     $isValidHeader = ((int)$row['header_layout'] !== 100 || !empty($this->mconf['sectionIndex.']['includeHiddenHeaders'])) && trim($row['header']) !== '';
                     if (!$doIncludeInSectionIndex || ($doHeaderCheck && !$isValidHeader)) {
                         continue;
-- 
GitLab