[BUGFIX] Only fetch fileReferences from localized table if column exist 87/54487/2
authorBenjamin Kott <benjamin.kott@wfp2.com>
Thu, 26 Oct 2017 15:54:56 +0000 (17:54 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Fri, 27 Oct 2017 16:53:35 +0000 (18:53 +0200)
Only if a localized table also contains the requested column for file
references it will overlay the previous generated resultset.

Resolves: #82860, #67741
Releases: master, 8.7
Change-Id: I21fd60454123488ea312d6c6241f2622eab3f14c
Reviewed-on: https://review.typo3.org/54487
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Classes/Page/PageRepository.php

index 7a4c8b7..926e7b1 100644 (file)
@@ -1887,6 +1887,11 @@ class PageRepository
         $isTableLocalizable = (
             !empty($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
             && !empty($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'])
+            // Only fetch references if the field is defined in TCA. This is a special use-case
+            // for pages_language_overlay because it may be possible that a field is defined in TCA
+            // of "pages" but not in "pages_language_overlay". Once pages_language_overlay is removed
+            // this check can be removed as well
+            && isset($GLOBALS['TCA'][$tableName]['columns'][$fieldName])
         );
         if ($isTableLocalizable && $localizedId !== null) {
             $localizedReferences = $fileRepository->findByRelation($tableName, $fieldName, $localizedId);