diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index c7f536218e1b77902206e80f148e14d37dc5ed62..6f276a7a46acff9d40b885b680f7393d403a09ee 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -741,7 +741,7 @@ parameters: path: ../../typo3/sysext/core/Classes/DataHandling/DataHandler.php - - message: "#^Offset string does not exist on array\\{\\}\\.$#" + message: "#^Offset string on array\\{\\} on left side of \\?\\? does not exist\\.$#" count: 1 path: ../../typo3/sysext/core/Classes/DataHandling/DataHandler.php diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index c07c4b449e7059453691da8117853764608986cd..95d4a72d51dea6dc8a08de1234b59ed406b7eb45 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -3174,7 +3174,7 @@ class DataHandler implements LoggerAwareInterface } else { $this->copyRecord($table, (int)$id, $target, true, [], '', 0, $ignoreLocalization); } - $procId = $this->copyMappingArray[$table][$id]; + $procId = $this->copyMappingArray[$table][$id] ?? null; break; case 'localize': $this->useTransOrigPointerField = true; @@ -3195,7 +3195,7 @@ class DataHandler implements LoggerAwareInterface break; } $this->useTransOrigPointerField = $backupUseTransOrigPointerField; - if (is_array($pasteUpdate)) { + if (is_array($pasteUpdate) && $procId > 0) { $pasteDatamap[$table][$procId] = $pasteUpdate; } } @@ -3403,7 +3403,7 @@ class DataHandler implements LoggerAwareInterface $CPtable = $this->int_pageTreeInfo([], $uid, (int)$this->copyTree, $theNewRootID); // Now copying the subpages: foreach ($CPtable as $thePageUid => $thePagePid) { - $newPid = $this->copyMappingArray['pages'][$thePagePid]; + $newPid = $this->copyMappingArray['pages'][$thePagePid] ?? null; if (isset($newPid)) { $this->copySpecificPage($thePageUid, $newPid, $copyTablesAlongWithPage); } else { @@ -6395,7 +6395,7 @@ class DataHandler implements LoggerAwareInterface $thePidToUpdate = $theUidToUpdate; } elseif (isset($this->registerDBPids[$table][$uid])) { $thePidToUpdate = $this->registerDBPids[$table][$uid]; - $thePidToUpdate = $this->copyMappingArray_merged['pages'][$thePidToUpdate]; + $thePidToUpdate = $this->copyMappingArray_merged['pages'][$thePidToUpdate] ?? null; } // Update child records if change to pid is required diff --git a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php index 088d1cbcea1634674572c5cc400e2c3fabba518f..241256f67d143db216bf79fa94e497b8e4de9f9e 100644 --- a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php +++ b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php @@ -1085,7 +1085,8 @@ class DataMapProcessor $ancestorIdMap[$ancestorId] ); if (!empty($possibleChainedIds)) { - $ancestorId = $possibleChainedIds[0]; + // use the first found id from `$possibleChainedIds` + $ancestorId = reset($possibleChainedIds); $dependentIdMap[$ancestorId] = $dependentId; } }