[BUGFIX] IRRE: Check if TCA['ctrl']['languageField'] is set 44/53944/5
authorOliver Hader <oliver@typo3.org>
Tue, 19 Sep 2017 10:58:13 +0000 (12:58 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 19 Sep 2017 12:24:11 +0000 (14:24 +0200)
On creating child records for an inline field, the values of
TCA['ctrl']['languageField'] configuration of parent and child
records are used without checking if they are set at all.
This patch adds appropriate guards.

Resolves: #82330
Releases: 7.6
Change-Id: I6383e55820239b0363ff890855430ac32e2cdf62
Reviewed-on: https://review.typo3.org/53944
Reviewed-by: Tobias Liebig <tobias.liebig@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php

index 44dd8af..d4b30b0 100644 (file)
@@ -134,10 +134,12 @@ class FormInlineAjaxController
 
         // Set language of new child record to the language of the parent record
         if ($parent['localizationMode'] !== 'keep' && MathUtility::canBeInterpretedAsInteger($parent['uid'])) {
-            $parentRecord = BackendUtility::getRecord($parent['table'], $parent['uid']);
             $parentLanguageField = $GLOBALS['TCA'][$parent['table']]['ctrl']['languageField'];
             $childLanguageField = $GLOBALS['TCA'][$child['table']]['ctrl']['languageField'];
-            $childData['databaseRow'][$childLanguageField][0] = $parentRecord[$parentLanguageField];
+            if (!empty($parentLanguageField) && !empty($childLanguageField)) {
+                $parentRecord = BackendUtility::getRecord($parent['table'], $parent['uid']);
+                $childData['databaseRow'][$childLanguageField][0] = $parentRecord[$parentLanguageField];
+            }
         }
 
         if ($parentConfig['foreign_selector'] && $parentConfig['appearance']['useCombination']) {