#105907Wrong order of selection of language fallbacks in link generation (mutiple IDs in the language chain)
Description
Hey everyone,
I found out, that the PageRepository select the wrong overlays in case of multiple fallbacks in the site language configuration (in link building process). I reproduce this with a TYPO3 v12.
Example : There is one language (ID: 19) with the configuration of fallbacks. The value of the fallback in the site configuration is ’915,900’ (incl. fallbackType = fallback). If the language “19” is rendered a page, that do not exist in language “19”, the PageRepository handle the overlay mechanism wrong. `PageRepository->getPageOverlaysForLanguage` add the current rendered language in front of the list of selected UIDs and the checked list is `19, 900, 915` in my case (The current rendered language is first, but the language fallback chain is reversed??).
As Result: In the following lines the pages are selected and become “candidates”. The priority is based on the order, so the wrong page language “900” is returned and not the language record of 915 that is configured first in the site configuration fallback chain.
In my case, I saw the problem only in the link generation, because the slugs of the links come from the wrong language (the content is the right one, only links are wrong).
Here is the line which change of the order of the fallback chain: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php#L381 (introduced in this commit: https://github.com/TYPO3/typo3/commit/b00bc4bd822adb037c6a57726d96acd99153bab8)
Why the chain is reversed in case of LanguageAspect::OVERLAYS_MIXED mode? Does anybody else have the problem, if there are more than one language in the fallbackChain?
Regards,
Tim
Reviews 3
History 48
-
Tim Lochmüller commented <span data-processor="relativetime" data-value="2025-01-27T15:32:58+00:00" > 01/27/25, 15:32 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 87989 status
NewUnder Review <span data-processor="relativetime" data-value="2025-02-03T08:59:59+00:00" > 02/03/25, 08:59 </span> -
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-02-03T09:00:37+00:00" > 02/03/25, 09:00 </span>
I have added your patch as a suggestion for review. I’m not too much into this, but maybe it can push a fix forward.
-
Gerrit Code Review pushed patch set 9 for main to change 83169 <span data-processor="relativetime" data-value="2025-03-28T15:59:20+00:00" > 03/28/25, 15:59 </span>
-
Gerrit Code Review pushed patch set 10 for main to change 83169 <span data-processor="relativetime" data-value="2025-03-28T16:11:16+00:00" > 03/28/25, 16:11 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 88828 <span data-processor="relativetime" data-value="2025-03-28T16:20:18+00:00" > 03/28/25, 16:20 </span>
-
Stephan Salzmann commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-03-28T16:35:09+00:00" > 03/28/25, 16:35 </span>Applied in changeset commit:c1701b21d5aa9c65b616719eba3ff52e47275ee1.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:27:12+00:00" > 12/02/25, 14:27 </span>
I think I found the problem. The “array_reverse” is only for the overlay mechanism a few lines later (works with array_pop – https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php#L391 ), but not for the ‘pages’ overlay. The regular pages language overlays need the fallback chain in the “regular” order.
So the solution should be, just move the array_reverse next to https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php#L391 for the regular content/record overlays.