Project

General

Profile

Actions

Bug #90531

closed

Requirements are not considered when an aspect is present

Added by Stefan P about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2020-02-25
Due date:
% Done:

100%

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

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.


Related issues 6 (2 open4 closed)

Related to TYPO3 Core - Bug #86895: routeEnhancer not working correct for paginate widgetClosed2018-11-09

Actions
Related to TYPO3 Core - Bug #87333: Slug fieldSeparator default value collides with symfony strict requirementsClosed2019-01-05

Actions
Related to TYPO3 Core - Bug #89263: TCEMAIN.preview doesn't work for routed controller with empty argumentsNew2019-09-25

Actions
Related to TYPO3 Core - Bug #88291: Exception thrown if slash in route field of PersistedPatternMapper aspectClosed2019-05-07

Actions
Related to TYPO3 Core - Bug #91246: routeEnhancer defaults not applied in TYPO3 v9.5.16Closed

Actions
Related to TYPO3 Core - Bug #91633: 9.5.19 breaks formerly working routeEnhancerUnder ReviewOliver Hader2020-06-10

Actions
Actions #1

Updated by Stefan P about 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...

Actions #2

Updated by Oliver Bartsch about 4 years ago

  • Related to Bug #86895: routeEnhancer not working correct for paginate widget added
Actions #4

Updated by Stefan P about 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.

Actions #5

Updated by Christian Eßl about 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.

Actions #6

Updated by Christian Eßl about 4 years ago

  • Related to Bug #87333: Slug fieldSeparator default value collides with symfony strict requirements added
Actions #7

Updated by Christian Eßl about 4 years ago

  • Related to Bug #89263: TCEMAIN.preview doesn't work for routed controller with empty arguments added
Actions #8

Updated by Christian Eßl about 4 years ago

  • Related to Bug #88291: Exception thrown if slash in route field of PersistedPatternMapper aspect added
Actions #9

Updated by Gerrit Code Review about 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

Actions #10

Updated by Gerrit Code Review about 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

Actions #11

Updated by Gerrit Code Review about 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

Actions #12

Updated by Gerrit Code Review about 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

Actions #13

Updated by Gerrit Code Review about 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

Actions #14

Updated by Christian Eßl about 4 years ago

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

Updated by Benni Mack about 4 years ago

  • Status changed from Resolved to Closed
Actions #16

Updated by Oliver Hader almost 4 years ago

  • Related to Bug #91246: routeEnhancer defaults not applied in TYPO3 v9.5.16 added
Actions #17

Updated by Oliver Hader almost 4 years ago

  • Related to Bug #91633: 9.5.19 breaks formerly working routeEnhancer added
Actions

Also available in: Atom PDF