From 9b61b3973b823ca5f0059173971ad42047ccb075 Mon Sep 17 00:00:00 2001
From: Thomas Hohn <tho@gyldendal.dk>
Date: Sun, 13 Aug 2023 20:32:53 +0200
Subject: [PATCH] [BUGFIX] Fix undefined array key "pages" in FileContentParser

Fix undefined array key "pages" in FileContentParser by adding
a null coalescing operator.

Resolves: #101450
Releases: main, 12.4, 11.5
Change-Id: Idc3bba5d5ab5516689925fadec86e6fac5978e73
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80544
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/indexed_search/Classes/FileContentParser.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/indexed_search/Classes/FileContentParser.php b/typo3/sysext/indexed_search/Classes/FileContentParser.php
index 4162f14c5c49..74513f1d4238 100644
--- a/typo3/sysext/indexed_search/Classes/FileContentParser.php
+++ b/typo3/sysext/indexed_search/Classes/FileContentParser.php
@@ -477,7 +477,7 @@ class FileContentParser
                     CommandUtility::exec($cmd, $res);
                     $pdfInfo = $this->splitPdfInfo($res);
                     unset($res);
-                    if ((int)$pdfInfo['pages']) {
+                    if ((int)($pdfInfo['pages'] ?? 0)) {
                         [$low, $high] = explode('-', $cPKey);
                         // Get pdf content:
                         $tempFileName = GeneralUtility::tempnam('Typo3_indexer');
-- 
GitLab