From febe4cb8ba1bb7fa4901a1bea47d36036b936003 Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Mon, 2 Aug 2021 11:36:44 +0200
Subject: [PATCH] [BUGFIX] Fix PHP 8 warnings in FinisherOptionGenerator

This fixes an array to string conversion and an undefined
array key warning in EXT:form FinisherOptionGenerator.

Resolves: #94686
Releases: master
Change-Id: Ic6265c36ac0f53d70d85baabf9d1881263027207
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70179
Tested-by: core-ci <typo3@b13.com>
Tested-by: Jochen <rothjochen@gmail.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Jochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 .../Processors/FinisherOptionGenerator.php           | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/form/Classes/Domain/Configuration/FlexformConfiguration/Processors/FinisherOptionGenerator.php b/typo3/sysext/form/Classes/Domain/Configuration/FlexformConfiguration/Processors/FinisherOptionGenerator.php
index ec9ef4fc3ac0..1ac281f2edd0 100644
--- a/typo3/sysext/form/Classes/Domain/Configuration/FlexformConfiguration/Processors/FinisherOptionGenerator.php
+++ b/typo3/sysext/form/Classes/Domain/Configuration/FlexformConfiguration/Processors/FinisherOptionGenerator.php
@@ -72,17 +72,21 @@ class FinisherOptionGenerator extends AbstractProcessor
         } catch (MissingArrayPathException $exception) {
         }
 
+        if (isset($elementConfiguration['config'])) {
+            $elementConfiguration['config']['default'] = $optionValue;
+        }
+
         $languageService = $this->getLanguageService();
+        $elementConfiguration['label'] = (string)($elementConfiguration['label'] ?? '');
         if (empty($optionValue)) {
             $elementConfiguration['label'] .= sprintf(' (%s: "%s")', $languageService->getLL('default'), $languageService->getLL('empty'));
         } else {
+            if (is_array($optionValue)) {
+                $optionValue = implode(',', $optionValue);
+            }
             $elementConfiguration['label'] .= sprintf(' (%s: "' . $optionValue . '")', $languageService->getLL('default'));
         }
 
-        if (isset($elementConfiguration['config'])) {
-            $elementConfiguration['config']['default'] = $optionValue;
-        }
-
         $sheetElements = $this->converterDto->getResult();
         $sheetElements['settings.finishers.' . $finisherIdentifier . '.' . $optionKey]['TCEforms'] = $elementConfiguration;
 
-- 
GitLab