Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[4.2] [Routing] Matching trailing slashes is not possible anymore #29734

Copy link
Copy link
Closed
@derrabus

Description

@derrabus
Issue body actions

Symfony version(s) affected: 4.2.2-dev

Description
We have certain routes that have a suffix that is passed as-is to the controller. If the suffix is just a singe slash, that slash is not matched anymore.

Since we strip the slash anyway, this only broke our integration tests. However, such a change is a bit unexpected between minor versions.

How to reproduce

use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

$routeCollection = new RouteCollection();
$routeCollection->add('test', new Route(
    '/some/route{pathSuffix}',
    ['pathSuffix' => ''],
    ['pathSuffix' => '(|/.*)']
));

$matcher = new UrlMatcher($routeCollection, new RequestContext());

dump($matcher->match('/some/route/'));

Output with Routing 4.2.1 and below:

array:2 [
  "pathSuffix" => "/"
  "_route" => "test"
]

Output with Routing 4.2.2-dev:

array:2 [
  "pathSuffix" => ""
  "_route" => "test"
]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.