From 5ceb5f5a05ea6bcfd250bbf95b58e47ab95bd42d Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Thu, 3 Aug 2023 13:22:02 +0200
Subject: [PATCH] [BUGFIX] Fix error copying pages with outdated user
 permissions

If the user permissions contain DB tables which are not available
anymore, a notice is turned into an exception.

Resolves: #101547
Releases: main, 12.4, 11.5
Change-Id: I98cd8fb74893c31fe8ca6c14e4ee87ddb0e578ae
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82125
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
---
 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 1d982d41202b..60613b87a278 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -3843,7 +3843,7 @@ class DataHandler implements LoggerAwareInterface
         if ($theNewRootID) {
             foreach ($copyTablesArray as $table) {
                 // All records under the page is copied.
-                if ($table && is_array($GLOBALS['TCA'][$table]) && $table !== 'pages') {
+                if ($table && is_array($GLOBALS['TCA'][$table] ?? false) && $table !== 'pages') {
                     $fields = ['uid'];
                     $languageField = null;
                     $transOrigPointerField = null;
-- 
GitLab