[BUGFIX] Only fetch fileReferences from localized table if column exist 79/54479/5
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 15:25:12 +0000 (17:25 +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/54479
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
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 87851d3..78ebcc8 100644 (file)
@@ -1856,6 +1856,11 @@ class PageRepository implements LoggerAwareInterface
         $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);