Project

General

Profile

Actions

Bug #92142

open

PageRouter does not find correct page candidates when using mount points

Added by Xavier Perseguers over 3 years ago. Updated 12 months ago.

Status:
Under Review
Priority:
Should have
Category:
Link Handling, Site Handling & Routing
Target version:
Start date:
2020-08-31
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

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)

We have domain.tld with the following structure:

.
|-- [1] domain.tld (slug = /)
|   `-- [2] share (slug = /share, mount_pid=3, mount_pid_ol=0)
|
|-- [3] shared pages
|   `-- [4] login (slug = /login)   
.

Language configuration

  • domain.tld is configured for French (default), German (sys_language_uid=1), Italian (sys_language_uid=3) and English (sys_language_uid=4)
  • shared pages is 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'
  -

The 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 sys_language_uid=0.

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.

Problem

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.

Analysis

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 /authentification.

If you manually try to access the page /fr/share/login, then the URL resolution works and you get the page.

Fix

Method 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.

Actions #1

Updated by Gerrit Code Review over 3 years 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

Actions #2

Updated by Josef Glatz about 3 years ago

Hey Xavier, is #91230 somehow related?

Actions #3

Updated by Xavier Perseguers about 3 years 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.

Actions #4

Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch main 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

Actions #5

Updated by Gerrit Code Review 12 months ago

Patch set 3 for branch main 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

Actions

Also available in: Atom PDF