[TASK] Separate site resolving from page slug resolving 62/58062/11
authorBenni Mack <benni@typo3.org>
Tue, 28 Aug 2018 16:41:59 +0000 (18:41 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Wed, 29 Aug 2018 13:41:59 +0000 (15:41 +0200)
commit4716a07cb6d7c747183264d7f3a585bc15d1e42d
tree919bbfffe94faa875bf8c6a85ca5cdedec1ef75f
parentef5b9c18bc2e699374112949f123ee15c07aa771
[TASK] Separate site resolving from page slug resolving

Currently, the site resolver checks for a valid site, and if so,
checks for valid page slugs. The latter is now moved to the
"PageResolver" middleware where the actual root line within
TSFE is resolved, and is now decoupled.

On top, a new "RouteResult" Array Access object is added
which is attached to the PSR-7 request as attribute "routing",
which will later be used for extensions
to add their own custom mappings.

The RouteResult object is now returned from the SiteMatcher
and PageRouter in order to encapsulate symfony/routing API
even more and to work with objects instead of array with magic
properties like "next" - which was actually renamed to "tail".

Fixes with this change:
- Proper and defined 307 redirect from a site (like www.domain.com)
to the default language (www.domain.com/en/)
- Proper and defined 307 redirect when a site/language is defined
without a trailing slash but accessed with a trailing slash and vice versa
- Proper and defined 307 redirect when a page slug is defined
without a trailing slash but accessed with a trailing slash and vice versa

Tests for SiteResolving have been streamlined and tests for
PageResolver have been added.

Please note:
The hook for checkAlternativeIdMethods() is now only called for
Frontend Requests without site handling.

Resolves: #86013
Releases: master
Change-Id: I9309d4092d007d555b37d575539ecf42303628de
Reviewed-on: https://review.typo3.org/58062
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/core/Classes/Routing/PageRouter.php
typo3/sysext/core/Classes/Routing/RouteResult.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/SiteMatcher.php
typo3/sysext/core/Documentation/Changelog/master/Feature-85947-PageBasedURLHandling.rst
typo3/sysext/frontend/Classes/Middleware/PageResolver.php
typo3/sysext/frontend/Classes/Middleware/SiteResolver.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php
typo3/sysext/frontend/Tests/Unit/Middleware/PageResolverTest.php [new file with mode: 0644]
typo3/sysext/frontend/Tests/Unit/Middleware/SiteResolverTest.php