From df6c9fcfc188f80c69123dbd3b7a4fabefe9f647 Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Tue, 19 Dec 2023 23:58:49 +0100
Subject: [PATCH] [BUGFIX] Prevent Undefined array key `debugMode` in Indexer

Resolves: #102383
Releases: main, 12.4, 11.5
Change-Id: Iced9d71874a51ee321857b662fa157ca2c2c0307
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82239
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
---
 typo3/sysext/indexed_search/Classes/Indexer.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/indexed_search/Classes/Indexer.php b/typo3/sysext/indexed_search/Classes/Indexer.php
index 4fac8c4b795b..22a6ab353528 100644
--- a/typo3/sysext/indexed_search/Classes/Indexer.php
+++ b/typo3/sysext/indexed_search/Classes/Indexer.php
@@ -268,7 +268,7 @@ class Indexer
         /** @var Lexer $lexer */
         $lexer = GeneralUtility::makeInstance($lexerObjectClassName);
         $this->lexerObj = $lexer;
-        $this->lexerObj->debug = $this->indexerConfig['debugMode'];
+        $this->lexerObj->debug = (bool)($this->indexerConfig['debugMode'] ?? false);
         // Initialize metaphone hook:
         // Make sure that the hook is loaded _after_ indexed_search as this may overwrite the hook depending on the configuration.
         if ($this->enableMetaphoneSearch && ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['metaphone'] ?? false)) {
@@ -1230,7 +1230,7 @@ class Indexer
             $connection->insert('index_fulltext', $fields);
         }
         // PROCESSING index_debug
-        if ($this->indexerConfig['debugMode']) {
+        if ($this->indexerConfig['debugMode'] ?? false) {
             $fields = [
                 'phash' => $this->hash['phash'],
                 'debuginfo' => json_encode([
@@ -1392,7 +1392,7 @@ class Indexer
             $connection->insert('index_fulltext', $fields);
         }
         // PROCESSING index_debug
-        if ($this->indexerConfig['debugMode']) {
+        if ($this->indexerConfig['debugMode'] ?? false) {
             $fields = [
                 'phash' => $hash['phash'],
                 'debuginfo' => json_encode([
-- 
GitLab