diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 04b498b61827b46630e2c81a2a2389c9f6a07244..16bdb2bf9ee228a894a7a1e1b98ad4dce92f95ee 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -396,7 +396,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 977daf6094f64c03c25f1b967f24fa5bdbd3926b..62f5640fa24628efd17e49c5c7f79693cfd7c140 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -3552,7 +3552,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; @@ -3573,7 +3573,7 @@ class DataHandler implements LoggerAwareInterface break; } $this->useTransOrigPointerField = $backupUseTransOrigPointerField; - if (is_array($pasteUpdate)) { + if (is_array($pasteUpdate) && $procId > 0) { $pasteDatamap[$table][$procId] = $pasteUpdate; } } @@ -3782,7 +3782,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 { @@ -6744,7 +6744,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 @@ -6803,7 +6803,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; } if ($thePidToUpdate && $updatePidForRecords !== []) { diff --git a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php index aafd62607d40ce396d335302600957f2d4b5f8b5..cce37df8cdd5e2d53a799d4d5bbf90fe6bc52d22 100644 --- a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php +++ b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php @@ -1043,7 +1043,8 @@ class DataMapProcessor $ancestorIdMap[$ancestorId] ); if (!empty($possibleChainedIds)) { - $ancestorId = $possibleChainedIds[0]; + // use the first found id from `$possibleChainedIds` + $ancestorId = reset($possibleChainedIds); $dependentIdMap[$ancestorId] = $dependentId; } }