From 38a8b46dedbed244be773a627b981308f037e3ff Mon Sep 17 00:00:00 2001
From: "sypets@gmx.de" <sypets@gmx.de>
Date: Mon, 13 Feb 2023 17:46:32 +0100
Subject: [PATCH] [BUGFIX] Handle array access in LocalImageProcessor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Handle missing image dimensions (width, height)
without throwing an exception.

In same cases, image dimension may not be able to be
set properly.

Resolves: #99406
Releases: main, 11.5
Change-Id: I81124dcaf29932448a87b69ab5bf6445eeb7469c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77757
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
---
 .../core/Classes/Resource/Processing/LocalImageProcessor.php  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php b/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php
index 9e0263d556bf..c7bdbac3b3dc 100644
--- a/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php
+++ b/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php
@@ -121,8 +121,8 @@ class LocalImageProcessor implements ProcessorInterface, LoggerAwareInterface
             $task->setExecuted(true);
             $imageDimensions = $this->getGraphicalFunctionsObject()->getImageDimensions($localProcessedFile);
             $properties = [
-                'width' => $imageDimensions[0],
-                'height' => $imageDimensions[1],
+                'width' => $imageDimensions[0] ?? 0,
+                'height' => $imageDimensions[1] ?? 0,
                 'size' => filesize($localProcessedFile),
                 'checksum' => $task->getConfigurationChecksum(),
             ];
-- 
GitLab