Bug #90531
closedRequirements are not considered when an aspect is present
100%
Description
Follow up of: #86895
Now that requirements are not considered when an aspect is present a whole of our sites did break.
We have a customly programmed aspect (used in the ExtbasePluginEnhancer) which considered slashes and resolved the URL by itself (by exploding the slashes and finding the correct uid of the dataset). To make this work I did set the requirements to .*
(because the default requirement [^/]++
forbids slashes). We did this to have arbitrarily deep category trees which are represented in the url.
This change totally breaks this, because I can not set the requirements anymore (exception about [^/]++
because a slash is present). What is the solution for me here?
How do I resolve custom URLs containign slashes? I do not find any documentation or tutorials for this as well.
Updated by S P over 4 years ago
And because of #89862 I can not store nested / slash-containing urls in the slug field of extbase records to try it this way round...
Updated by Oliver Bartsch over 4 years ago
- Related to Bug #86895: routeEnhancer not working correct for paginate widget added
Updated by Markus Klein over 4 years ago
Updated by S P over 4 years ago
Markus Klein wrote:
Maybe related: https://stackoverflow.com/questions/60282463/routing-exception-after-upgrading-to-typo3-v9-5-14/
Related probably, but not the solution here. In our case a routing placeholder for the aspect contains something like this: category-1/category-sub/yet-another-sub-category
or just single-category
or two levels category-1/first-sub-category
We do not have any defaults specified because it's a persisted alias mapper in the end. Our aspect walks through a tree to build the slashed path (on frontend rendering) or to analyse the slashed path and find the correct uid (on http request-time).
The problem is that routing variables containing a slash can not be passed or returned from an aspect because the custom requirements are ignored now (and teh default requirement is [^/]++
which allows everything but forbids slashes).
Another problem is the linked #89862. The slug field in our databse rows is non-slashed (just the title field basically), the slashes are build purely by the aspect. We had to do this because of #89862 we can not use the SlugHelper or its hook to store slugs with slashes in teh database (this works reliably only for table pages
but not for custom tables).
So neither pre-calculation with the SlugHelper nor live-generating (requirement-enabled aspect) of slash-containign URLs for custom tables are currently working.
Updated by Christian Eßl over 4 years ago
Here is the reasoning behind the breaking change:
https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5.x/Important-86895-RouteAspectsTakePrecedenceOverRequirements.html
As soon as an aspect is present, the equirements regex is now automatically purged and not taken into consideration. Which now makes it impossible to use slashes in an enhanced path_segment.
Take ext:news for example. Right now, editors are allowed to add slashes to the path_segment of a news record. Doing so will crash the news list in the frontend when the route is built:
(1/1) Symfony\Component\Routing\Exception\InvalidParameterException
Parameter "tx_news_pi1__news" for route "tx_news_pi1_0" must match "[^/]++" ("tech/talk-1" given) to generate a corresponding URL.
Assuming the yaml routing config looks something like this:
NewsDetail:
type: Extbase
limitToPages:
- 8
extension: News
plugin: Pi1
routes:
-
routePath: '/{news_title}'
_controller: 'News::detail'
_arguments:
news_title: news
defaultController: 'News::detail'
requirements:
news_title: .+
aspects:
news_title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
The ".+" would allow slashes in the path_segment, but this option is now automatically stripped.
Updated by Christian Eßl over 4 years ago
- Related to Bug #87333: Slug fieldSeparator default value collides with symfony strict requirements added
Updated by Christian Eßl over 4 years ago
- Related to Bug #89263: TCEMAIN.preview doesn't work for routed controller with empty arguments added
Updated by Christian Eßl over 4 years ago
- Related to Bug #88291: Exception thrown if slash in route field of PersistedPatternMapper aspect added
Updated by Gerrit Code Review over 4 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/+/63529
Updated by Gerrit Code Review over 4 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/+/63529
Updated by Gerrit Code Review over 4 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/+/63529
Updated by Gerrit Code Review over 4 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/+/63529
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 9.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/+/63655
Updated by Christian Eßl over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 1ee7266e362ae454af2c8ed2e0209cc33407d8c7.
Updated by Oliver Hader over 4 years ago
- Related to Bug #91246: routeEnhancer defaults not applied in TYPO3 v9.5.16 added
Updated by Oliver Hader over 4 years ago
- Related to Bug #91633: 9.5.19 breaks formerly working routeEnhancer added