Skip to content

Symfony 4 The route is wrongly configured #29294

Closed
@barricade86

Description

@barricade86

Symfony version(s) affected: 4.1.7

Description
We have the next route:

$path = '/{siteSection}/{categoryPath}/';
        $defaults = [
            '_controller' => 'SiteBundle\Controller\Category:index',
        );
        $requirements = array(
            'siteSection' => 'catalog',
            'categoryPath' => '([\d\w-]+\/*?){2,4}'
        ];
        $routes = new RouteCollection();
        $route = new Route($path, $defaults, $requirements);

        // add the new route to the route collection
        $routeName = 'catalog.category_controller';
        $routes->add($routeName, $route);               
        $router = new Router(OneOfLoaders, 'routing.yml');
        $routeInfo = $this->router->match('/catalog/large_and_small_appliances/large_appliances/');

For example, we have the next URI:

  1. /catalog/large_and_small_appliances/large_appliances/
  2. /catalog/large_and_small_appliances/
    On Symfony 4.0 there was no issues with these URI. They' re worked as expected. When i updated symfony on 4.1, i got issues with them. The first URI in browser gives me an error: ResourceNotFoundException

The second one is OK.
Command: php bin/console router:match --host=my_host /catalog/large_and_small_appliances/ --scheme=https
shows the route catalog.category_controller(as expected). Any ideas, what's wrong?

Additional context
They're both ok on Symfony 4.0

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