From 5b51986a28dd5610f376f1c33b492ae094df36fd Mon Sep 17 00:00:00 2001
From: Philipp Kitzberger <typo3@kitze.net>
Date: Tue, 10 Oct 2023 10:04:39 +0200
Subject: [PATCH] [BUGFIX] Fix another PHP 8 warning in DataHandler
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Resolves: #102134
Releases: main, 12.4, 11.5
Change-Id: I3aaf6f2c8161579394a0dbe1c9f470edeb0a8bca
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81349
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
---
 typo3/sysext/core/Classes/DataHandling/DataHandler.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index e1b3406ceac8..8a103da28e25 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -7403,8 +7403,11 @@ class DataHandler implements LoggerAwareInterface
                 // This feature is used by the import functionality to force a new record to have a certain UID value.
                 // This is only recommended for use when the destination server is a passive mirror of another server.
                 // As a security measure this feature is available only for Admin Users (for now)
+                // The value of $this->suggestedInsertUids["table":"uid"] is either string 'DELETE' (ext:impexp) to trigger
+                // a blind delete of any possibly existing row before insert with forced uid, or boolean true (testing-framework)
+                // to only force the uid insert and skipping deletion of an existing row.
                 $suggestedUid = (int)$suggestedUid;
-                if ($this->BE_USER->isAdmin() && $suggestedUid && $this->suggestedInsertUids[$table . ':' . $suggestedUid]) {
+                if ($this->BE_USER->isAdmin() && $suggestedUid && ($this->suggestedInsertUids[$table . ':' . $suggestedUid] ?? false)) {
                     // When the value of ->suggestedInsertUids[...] is "DELETE" it will try to remove the previous record
                     if ($this->suggestedInsertUids[$table . ':' . $suggestedUid] === 'DELETE') {
                         $this->hardDeleteSingleRecord($table, (int)$suggestedUid);
-- 
GitLab