From 049447f71a7b48a4ed6c9fb4b348933e26efd24d Mon Sep 17 00:00:00 2001 From: Christoph Lehmann Date: Wed, 13 Sep 2023 17:28:39 +0200 Subject: [PATCH] [BUGFIX] Resolve undefined array key warning in FlexFormProcessor Exception message was PHP Warning: Undefined array key "pi_flexform" in /.../typo3/typo3/typo3conf/ext/headless/Classes/DataProcessing/FlexFormProcessor.php line 102 --- Classes/DataProcessing/FlexFormProcessor.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Classes/DataProcessing/FlexFormProcessor.php b/Classes/DataProcessing/FlexFormProcessor.php index 60b72e18..15815fd2 100644 --- a/Classes/DataProcessing/FlexFormProcessor.php +++ b/Classes/DataProcessing/FlexFormProcessor.php @@ -99,16 +99,15 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu $fieldName = 'pi_flexform'; } - if (!$processedData['data'][$fieldName] && !$processedData[$fieldName]) { + // processing the flexform data + $originalValue = $processedData['data'][$fieldName] ?? $processedData[$fieldName] ?? null; + if ($originalValue === null) { return $processedData; } - // processing the flexform data - $originalValue = $processedData['data'][$fieldName] ?? $processedData[$fieldName]; - if (\is_array($originalValue)) { $flexformData = $originalValue; - } elseif (\is_string($originalValue)) { + } elseif (\is_string($originalValue) && !empty($originalValue)) { $flexformData = $this->flexFormService->convertFlexFormContentToArray($originalValue); } else { return $processedData;