Bug #86331

Mountpoints not working with new site configurations

Added by Alexander Grein about 1 year ago. Updated 4 months ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Start date:
2018-09-20
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

To reproduce:

Add two root pages with a site configuration for each.

Add a standard page with the name "page1" to site a.

Add a mountpoint page with the same name to site b.

Try to open page1 of site b in a browser: e.g. www.site-b.com/page1

Expected:
A page containing the same content as www.site-a.com/page1

Result:
A automatic redirect to a page with a url like www.site-*a*.com/page1?MP=3-20 showing an error:
PageNotFoundException: ID was outside the domain

The menu provider also generates wrong links to the site a with additional MP parameter.

History

#1 Updated by Alexander Grein about 1 year ago

I forgot to mention:
Put the mountpoint of "page1" of site b to "page1" of site a

#2 Updated by Georg Ringer about 1 year ago

  • Category set to Link Handling, Site Handling & Routing

#3 Updated by Sascha Wilking about 1 year ago

I can reproduce it. It doesn't matter what the page's name is. In my scenario i have the entry domain2.local/test1, where page "test1" is a mount point to another root (domain1.local) with page "test2". The menu link on domain2.local is also wrong and points to domain1.local/test2.

#4 Updated by Alexander Grein about 1 year ago

It looks like, that the whole MP handling is a known open point in typo3/sysext/core/Classes/Routing/PageUriBuilder.php (line 36):

  • @todo: check handling of MP parameter.

#5 Updated by Josef Glatz 12 months ago

  • Priority changed from Should have to Must have

#6 Updated by Benni Mack 12 months ago

  • Target version set to next-patchlevel

#7 Updated by Susanne Moog 11 months ago

  • Sprint Focus set to On Location Sprint

#8 Updated by Nicolai Schirawski 11 months ago

I will have a look onto the problem in typo3 sprint berlin

#9 Updated by Nicolai Schirawski 11 months ago

Hier eine Dokumentation über das Verhalten der Mountpoints in TYPO3 9.5.1-dev:

Verhalten innerhalb einer Domain:
                                slug laut BE                Link auf diese Seite                    angezeigter Inhalt
-----------------------------------------------------------------------------------------------------------------
Rootseite           pid 1       slug: /                     link: domain1/
|__unter1           pid 2       slug: /unter1               link: domain1/unter1
   |__u11           pid 3       slug: /unter1/u11           link: domain1/unter1/u11                Inhalt: "u11" 
      |__u111       pid 4       slug: /unter1/u11/u111      link: domain1/unter1/u11/u111           Inhalt: "u111" 

----- Alternative1 :mount 1 mounted auf pid3; "show mounted page" 

|__mount1           pid 5       slug: /mount1               link: domain1/unter1/u11?MP=3-5         Inhalt: "u11" 
                                                            link: domain1/unter1/u11/u111?MP=3-5    Inhalt: "u111" 

----- Alternative2 :mount 1 mounted auf pid3; "show this page" 

|__mount1           pid 5       slug: /mount1               link: domain1/mount1                    Inhalt: "mount1" 
                                                            link: domain1/unter1/u11/u111?MP=3-5    Inhalt: "u111" 

Verhalten Domain-übergreifend:

                                slug laut BE                Link auf diese Seite                    angezeigter Inhalt
-----------------------------------------------------------------------------------------------------------------
Rootseite2          pid 6       slug: /                     link: domain2/
|__unter2           pid 7       slug: /unter2               link: domain2/unter2
   |__u21           pid 8       slug: /unter2/u21           link: domain2/unter2/u21                Inhalt: "u21" 
      |__u211       pid 9       slug: /unter2/u21/u211      link: domain2/unter2/u21/u211           Inhalt: "u211" 

----- Alternative1 :mount 2 mounted auf pid3; "show mounted page" 

|__mount2           pid 10      slug: /mount2               link: domain1/unter1/u11?MP=3-10        Inhalt: => Exception!!!
                                                   Soll:    link: domain2/unter1/u11?MP=3-10        Inhalt: "u11" 

                                                            link: domain1/unter1/u11/u111?MP=3-10   Inhalt: => Exception!!!
                                                   Soll:    link: domain2/unter1/u11/u111?MP=3-10   Inhalt: "u111" 

----- Alternative2 :mount 2 mounted auf pid3; "show this page" 

|__mount2           pid 10      slug: /mount2               link: domain2/mount2                    Inhalt: "mount2" 

                                                            link: domain1/unter1/u11/u111?MP=3-10   Inhalt: => Exception!!!
                                                   Soll:    link: domain2/unter1/u11/u111?MP=3-10   Inhalt: "u111" 

#10 Updated by Nicolai Schirawski 11 months ago

I see major conceptional difficulties here. The question is: how do we want to deal with cross-domain-mounts?

The basic use case could be something like this: domain1 has a subtree, e.g. a blog, that should be shown on another page (domain2), too. On domain2 all mounted pages should have urls starting with "domain2".

By allowing that, we run into difficulties: we have to deal with internal links pointing out of the subtree onto other pages of domain1. The edge-case would be a sitemap being part of the subtree. Than the complete site domain1 would be visible under "domain2" as well.

This seems to be unwanted behaviour.

Possible solutions:
- we create a new page-property "allow shared" that allows a page and all of its subpages to be mounted on other domains as well. Internal links out of the shared pages must than either stay on the original domain or be disabled. Implementing that looks like a huge task.

- we just disallow cross-domain-mounts. The use-case "blog-subtree" could than be realised by creating a new subtree in domain2 and mapping all pages using "show content from page"

For the time beeing, I would suggest the second solution.

#11 Updated by Gerrit Code Review 7 months 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/+/59915

#12 Updated by Gerrit Code Review 7 months 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/+/59915

#13 Updated by Gerrit Code Review 7 months 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/+/59915

#14 Updated by Gerrit Code Review 7 months 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/+/59915

#15 Updated by Benni Mack 5 months ago

  • Target version changed from next-patchlevel to Candidate for patchlevel

#16 Updated by Christoph Kratz 4 months ago

$queryParameters['MP'] can have multiple comma-separated parameters, resulting in an endless redirect. The following exam works for me and fixes the problem.

typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php:188

if (!is_null($queryParameters['MP'])) {
  $mp = explode(",", $queryParameters['MP']);
  if (count($mp) > 1) {
    $queryParameters['MP'] = $mp[0];
  }
}
$siteOfTargetPage = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId((int)$page['uid'], null, $queryParameters['MP'] ?? '');

Also available in: Atom PDF