Bug #87333

Slug fieldSeparator default value collides with symfony strict requirements

Added by Guido Schmechel over 1 year ago. Updated 2 months ago.

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

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Context

I combine two fields via TCA Slug ['city', 'street']. TYPO3 builds the slug correctly to e.g. "cologne/streetname". This is also displayed in the backend in the slug field.

        'slug' => [
            'exclude' => true,
            'label' => 'URL Segment',
            'config' => [
                'type' => 'slug',
                'generatorOptions' => [
                    'fields' => ['city', 'street'],
                    'replacements' => [
                        '/' => '',
                        '&' => ''
                    ],
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInPid',
            ],
        ],

Problem

If i call a list action which call this slug via f:link.page I get this error message:

Parameter "tx_ayacoopoi_poi__poi" for route "tx_ayacoopoi_poi_0" must match "[^/]++" ("cologne/streetname" given) to generate a corresponding URL.

I have not defined a field separator in the TCA config and so a slash is used by the code => https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/DataHandling/SlugHelper.php#L185

Symfony routing is in strict mode and so the slash isn't allowed.

Route Enhancer

routeEnhancers:
  DetailPoi:
    type: Extbase
    extension: AyacooPoi
    plugin: Poi
    routes:
      - { routePath: '{slug}', _controller: 'Poi::detail', _arguments: {'slug' : 'poi'} }
    defaultController: 'Poi::detail'
    aspects:
      slug:
        type: PersistedAliasMapper
        tableName: 'tx_ayacoopoi_domain_model_poi'
        routeFieldName: 'slug'
        routeValuePrefix: '/'

Related issues

Related to TYPO3 Core - Bug #88291: Exception thrown if slash in route field of PersistedPatternMapper aspect Closed 2019-05-07
Related to TYPO3 Core - Bug #89263: TCEMAIN.preview doesn't work for routed controller with empty arguments New 2019-09-25
Related to TYPO3 Core - Bug #90531: Requirements are not considered when an aspect is present Closed 2020-02-25

Associated revisions

Revision 1ee7266e (diff)
Added by Christian Eßl 3 months ago

[BUGFIX] Allow slashes in enhanced routes having aspects definitions

The changes made in #86895 broke previous behaviour in page routing by
disallowing the use of the "requirements" option for a route when
aspects are present - "aspects now take precedence over requirements".

While the reasoning behind this change is valid, the requirements in
the Symfony Routing package would now always default to '[^/]++'
(every character except "/") for routes that use aspects.

Before, it was possible to manually set the requirements to '.+' to
allow slashes in an argument value.

Instead of purging requirements for variable names having an aspect
definition as well, thoese requirements are set to `.+` to relax the
default Symfony constraints on default delimiter `/` in this case.

Resolves: #90531
Resolves: #88291
Resolves: #87333
Related: #86895
Releases: master, 9.5
Change-Id: I27076aa0425d050e729db84d8e3461a329321342
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63529
Tested-by: Oliver Hader <>
Tested-by: TYPO3com <>
Tested-by: Christian Eßl <>
Tested-by: Benni Mack <>
Reviewed-by: Oliver Hader <>
Reviewed-by: Christian Eßl <>
Reviewed-by: Benni Mack <>

Revision e98ba4a4 (diff)
Added by Christian Eßl 3 months ago

[BUGFIX] Allow slashes in enhanced routes having aspects definitions

The changes made in #86895 broke previous behaviour in page routing by
disallowing the use of the "requirements" option for a route when
aspects are present - "aspects now take precedence over requirements".

While the reasoning behind this change is valid, the requirements in
the Symfony Routing package would now always default to '[^/]++'
(every character except "/") for routes that use aspects.

Before, it was possible to manually set the requirements to '.+' to
allow slashes in an argument value.

Instead of purging requirements for variable names having an aspect
definition as well, thoese requirements are set to `.+` to relax the
default Symfony constraints on default delimiter `/` in this case.

Resolves: #90531
Resolves: #88291
Resolves: #87333
Related: #86895
Releases: master, 9.5
Change-Id: I27076aa0425d050e729db84d8e3461a329321342
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63655
Reviewed-by: Oliver Hader <>
Reviewed-by: Benni Mack <>
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>

History

#1 Updated by Guido Schmechel over 1 year ago

  • Description updated (diff)

#2 Updated by Guido Schmechel over 1 year ago

  • Description updated (diff)

#3 Updated by Christian Eßl 3 months ago

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

#4 Updated by Christian Eßl 3 months ago

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

#5 Updated by Christian Eßl 3 months ago

  • Related to Bug #90531: Requirements are not considered when an aspect is present added

#6 Updated by Gerrit Code Review 3 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/+/63529

#7 Updated by Gerrit Code Review 3 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/+/63529

#8 Updated by Gerrit Code Review 3 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/+/63529

#9 Updated by Gerrit Code Review 3 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/+/63529

#10 Updated by Gerrit Code Review 3 months 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

#11 Updated by Christian Eßl 3 months ago

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

#12 Updated by Benni Mack 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF