PageRouter does not find correct page candidates when using mount points
When you have a mount point which is NOT translated, and try to access a (mounted) page which is translated, you get a PageNotFound exception.
The generation of the URL is properly created by TYPO3, but the decoding fails.
(Real) example configuration on how to reproduce¶
(there is possibly a shorter configuration but at least you have here a full real example)
domain.tld with the following structure:
. |--  domain.tld (slug = /) | `--  share (slug = /share, mount_pid=3, mount_pid_ol=0) | |--  shared pages | `--  login (slug = /login) .
domain.tldis configured for French (default), German (sys_language_uid=1), Italian (sys_language_uid=3) and English (sys_language_uid=4)
shared pagesis configured for English (default), German (sys_language_uid=1), French (sys_language_uid=2) and Italian (sys_language_uid=3)
In order for French in the context of
domain.tld to use any French translation in the context of
shared pages, we configure that domain to use
sys_language_uid=2 with a fallback to
0 (French and German configuration included, missing are Italian and English but they have the same structure):
languages: - title: Français enabled: true base: /fr/ typo3Language: fr locale: 'fr_CH.utf8,fr_CH.UTF-8' iso-639-1: fr websiteTitle: '' navigationTitle: Français hreflang: fr-CH direction: '' fallbackType: fallback fallbacks: '0' flag: fr languageId: '2' - title: Deutsch enabled: true base: /de/ typo3Language: de locale: 'de_CH.utf8,de_CH.UTF-8' iso-639-1: de websiteTitle: '' navigationTitle: Deutsch hreflang: de-CH direction: '' fallbackType: fallback fallbacks: '0' flag: de languageId: '1' -
shared pages have the exact same configuration.
How does it work?¶
/fr/ is configured to fetch content with
sys_language_uid=2 but there is none in the context of
domain.tld so it always falls back to French content with default language
When we access a shared page however, since we are with
sys_language_uid=2 we can properly access French-translated content in the context of those pages where English is the default language.
The same heppens the other way around, when being in English in
domain.tld, we are in
sys_language_uid=4 and when accessing content in the shared pages, we have no such content, it thus falls back to content with
sys_language_uid=0, default language which happens to be English in that context.
Page 4 is translated like that:
- Default (English): slug=/login
- German: slug=/anmeldung
- French: slug=/authentification
In a menu, you ask TYPO3 to generate a link to the login page. In the default language, you will get a link
http://domain.tld/fr/share/authentification but when clicking the link, you get a 404 Page Not Found.
Since page 2 (/share) is not translated, the PageRouter will be able to resolve it only when looking for page in
sys_language_uid=0. Then, as it is a mount point, it tries to match the rest of the URL with mounted pages but it does that in the context of
sys_language_uid=0 only, and NOT in the context of
sys_language_uid=2. As such it cannot match the slug
If you manually try to access the page
/fr/share/login, then the URL resolution works and you get the page.
findPageCandidatesOfMountPoint should be called with the whole list of requested languages so that any custom fallback logic is properly taken into account even if the mount point is untranslated.
Updated by Gerrit Code Review about 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65509
Updated by Xavier Perseguers 7 months ago
Hey Josef, possibly, that sounds a bit similar, you should have a look at the patch I created. My problem was with untranslated but as pointed out the logic in findPageCandidateOfMountPoint is invalid (well, incomplete) and may cause your own side-effect.