From a1d906d64b4bb81e6739cd396169bcb16e7772a0 Mon Sep 17 00:00:00 2001 From: Patrick Schriner <patrick.schriner@diemedialen.de> Date: Tue, 5 Mar 2024 12:37:20 +0100 Subject: [PATCH] [BUGFIX] Let import handle missing TCA for file relations better If a file relation's field config is missing the import now adds an error that makes identifying the broken TCA possible. Resolves: #103282 Releases: main, 12.4 Change-Id: I622b98fc256df2a994f0ff1477aebdd9b3953a4d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83211 Reviewed-by: Garvin Hicking <gh@faktor-e.de> Tested-by: Garvin Hicking <gh@faktor-e.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Willi Wehmeier <wwwehmeier@gmail.com> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Willi Wehmeier <wwwehmeier@gmail.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- typo3/sysext/impexp/Classes/Import.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/impexp/Classes/Import.php b/typo3/sysext/impexp/Classes/Import.php index cf939837a603..3e1713e876ae 100644 --- a/typo3/sysext/impexp/Classes/Import.php +++ b/typo3/sysext/impexp/Classes/Import.php @@ -1198,8 +1198,12 @@ class Import extends ImportExport if (isset($relation['type']) && !($table === 'sys_file_reference' && $field === 'uid_local') && $relation['type'] === 'db' && isset($GLOBALS['TCA'][$table]['columns'][$field])) { if (is_array($relation['itemArray'] ?? null) && !empty($relation['itemArray'])) { $fieldTca = $GLOBALS['TCA'][$table]['columns'][$field]; - $actualRelations = $this->remapRelationsOfField($relation['itemArray'], $fieldTca['config'], $field); - $updateData[$table][$actualUid][$field] = implode(',', $actualRelations); + if (is_array($fieldTca['config'])) { + $actualRelations = $this->remapRelationsOfField($relation['itemArray'], $fieldTca['config'], $field); + $updateData[$table][$actualUid][$field] = implode(',', $actualRelations); + } else { + $this->addError(sprintf('Error: Missing TCA "config" for field "%s:%s"', $table, $field)); + } } } } -- GitLab