Project

General

Profile

Actions

Bug #93240

closed

MultiTree concept for one domain not properly working with routing

Added by Torben Hansen over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2021-01-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Site Handling & Routing
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

When you have a TYPO3 website that handles exactly one domain for different languages, it is either possible to use a single tree which includes all languages or it is possible to configure one tree for each language (e.g. if the structure of the translated site strongly differs from the default language). Currently the last setup is not intuitively possible to archive, since there seems to be a bug in the SiteMatcher.

Scenario:

The domain http://master.typo3.local/ should be available in 4 languages.

  • German and english follow a strict translation (site1)
  • Danish only has a small subset of pages of the "main" site (site2)
  • French has a different page template and thus a different menu structure (site3)

3 sites are configured as shown on the following screenshot.

All 3 sites have http://master.typo3.local/ as entry point (base) and the appropriate language configuration with a base for each language.

Current behavior:

When opening http://master.typo3.local/, the website is shown in french (redirected to http://master.typo3.local/fr/). Expected is the german version of the website.

Problem location:

The SiteMatcher component uses the function getRouteCollectionForAllSites() to return a RouteCollection with possible sites for the current route. This function also uses the "main" entry point (without a language configuration) to resolve the route, so actually multiple matches for the "/" route will be determined. As seen on the screenshot below, actually all 3 sites will be considered to resolve the "/" route for the domain as shown on the debug output below.

Obviously, the last one "wins" when the Symfony UrlMatcher matches the rroute.

Possible solution:

getRouteCollectionForAllSites() should only add Sites the the RouteCollection, that also have a language. If I remove line 196 (https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Routing/SiteMatcher.php#L196), everything works fine. Since a Site Object always seem to have at least a language, it is not really clear to my, why getRouteCollectionForAllSites() also tries to match routes for sites with no language.

However, if line 196 is removed, unit tests for SiteMatcher fail.

Why not move the language to the entry point base?

It is possible to work around this problem by moving the language specific base to the entry point base. This will however be a problem, if e.g. the french site becomes a "subsite" having multiple languages, where the subsite URL segment also must be translated.

Example:

As shown in the example, it will not be possible to translate the subsite title, when it is part of the entry point base.


Files

routes.png (48.2 KB) routes.png Torben Hansen, 2021-01-07 18:54
sites.png (44.7 KB) sites.png Torben Hansen, 2021-01-07 19:04

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99149: Apply previous site identifier as fallback for URL resolvingResolved2022-11-21

Actions
Actions #1

Updated by Torben Hansen over 3 years ago

  • Description updated (diff)
Actions #2

Updated by Torben Hansen over 3 years ago

  • Description updated (diff)
Actions #3

Updated by Riccardo De Contardi over 3 years ago

  • Category set to Link Handling, Site Handling & Routing
Actions #4

Updated by Gerrit Code Review over 2 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/+/70572

Actions #5

Updated by Gerrit Code Review over 2 years ago

Patch set 2 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/+/70572

Actions #6

Updated by Gerrit Code Review over 2 years ago

Patch set 3 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/+/70572

Actions #7

Updated by Gerrit Code Review over 2 years ago

Patch set 4 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/+/70572

Actions #8

Updated by Helmut Hummel over 2 years ago

Torben Hansen wrote:

It is possible to work around this problem by moving the language specific base to the entry point base. This will however be a problem, if e.g. the french site becomes a "subsite" having multiple languages, where the subsite URL segment also must be translated.

Wouldn't it also work, when configuring all language base with a language code?
Otherwise the definition is ambiguous and the result cannot be determined because of the that.
If anything I'd add a validation and error message for such configuration.

Or am I missing something here?

Actions #9

Updated by Helmut Hummel over 2 years ago

Helmut Hummel wrote in #note-8:

Wouldn't it also work, when configuring all language base with a language code?

I'd even say, that having multiple sites with the same base is misconfiguration given how routes are generated based on sites and languages.

The configuration advertised here creates 4 routes with the same host/path, resolving to different sites. How should a resolver, which only gets host and path as input deterministically resolve to a specific site?

Or to ask differently:

Which routes do you expect to be generated from such TYPO3 site configurations?
And can we be sure that no other routes make sense (or could have been meant) for the same TYPO3 site configurations?

Actions #10

Updated by Helmut Hummel over 2 years ago

  • Status changed from Under Review to Needs Feedback
Actions #11

Updated by Gerrit Code Review over 2 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 5 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/+/70572

Actions #12

Updated by Stefan Busemann over 2 years ago

Helmut Hummel wrote in #note-8:

Torben Hansen wrote:

It is possible to work around this problem by moving the language specific base to the entry point base. This will however be a problem, if e.g. the french site becomes a "subsite" having multiple languages, where the subsite URL segment also must be translated.

Wouldn't it also work, when configuring all language base with a language code?
Otherwise the definition is ambiguous and the result cannot be determined because of the that.
If anything I'd add a validation and error message for such configuration.

Or am I missing something here?

Most Customers (and I have for this Szenario more then three) want to have a base domain without any language code and different options for regions as in this ticket required. So having a language code for every language is not preferred solution. This patch may not be the most elegant solution. But it works. Any other technical solution is welcomed to, but the issue should be solved. Since TYPO3 9 our customers lost a lot of flexibility for multilang / multi domain solutions. This patch would bring one solution back.

Actions #13

Updated by Gerrit Code Review over 2 years ago

Patch set 6 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/+/70572

Actions #14

Updated by Oliver Hader over 1 year ago

  • Sprint Focus set to On Location Sprint
Actions #15

Updated by Gerrit Code Review over 1 year 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/+/76464

Actions #16

Updated by Gerrit Code Review over 1 year ago

Patch set 4 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/+/76464

Actions #17

Updated by Gerrit Code Review over 1 year ago

Patch set 5 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/+/76464

Actions #18

Updated by Gerrit Code Review over 1 year ago

Patch set 6 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/+/76464

Actions #19

Updated by Oliver Hader over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #20

Updated by Gerrit Code Review over 1 year ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76513

Actions #21

Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76513

Actions #22

Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76513

Actions #23

Updated by Oliver Hader over 1 year ago

  • Status changed from Under Review to Resolved
Actions #24

Updated by Oliver Hader over 1 year ago

  • Related to Bug #99149: Apply previous site identifier as fallback for URL resolving added
Actions #25

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF