From ab90a35e6d561917eef5e3427eee67f3262fffd6 Mon Sep 17 00:00:00 2001
From: Ernesto Baschny <eb@cron.eu>
Date: Wed, 9 Aug 2023 19:12:52 +0200
Subject: [PATCH] [TASK] Fix PHP 8 compatibility in DataHandler

In case you add a new TCA field of type "slug" in the pages table
but without a config "eval", you get an exception in the backend.

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

diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index 6d62342645e5..c07c4b449e70 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -8386,7 +8386,7 @@ class DataHandler implements LoggerAwareInterface
         $newData = [];
         foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $conf) {
             if ($conf['config']['type'] === 'slug' && (string)$curData[$field] !== '') {
-                $evalCodesArray = GeneralUtility::trimExplode(',', $conf['config']['eval'], true);
+                $evalCodesArray = GeneralUtility::trimExplode(',', $conf['config']['eval'] ?? '', true);
                 if (in_array('uniqueInSite', $evalCodesArray, true)) {
                     $helper = GeneralUtility::makeInstance(SlugHelper::class, $table, $field, $conf['config'], $workspaceId);
                     $state = RecordStateFactory::forName($table)->fromArray($curData);
-- 
GitLab