Closed
Description
Hi,
I've a weird issue when using Symfony 4.4.8 or above.
A route defined with {_locale}
parameter leads to a 404 route not found error.
I have the following routes defined
/**
* @Route("/sites/{id}",
* name="site_get",
* methods={"GET"},
* requirements={"id": "\d+"},
* )
*
* @Route("/{_locale}/sites/{id}",
* name="site_get_with_locale",
* methods={"GET"},
* requirements={"id": "\d+", "_locale": "fr|en"},
* )
*
*/
With Symfony 4.4.8
When calling /en/sites/1
I get a 404 error "route not found".
The debug:router
show the defined routes :
site_get.0 GET ANY ANY /api/sites/{id}
site_get_with_locale.0 GET ANY ANY /api/{_locale}/sites/{id}
But the profiler gives a different routing configuration :
With Symfony 4.4.7
When calling /en/sites/1
everything is fine, I get the desired resource
The debug:router
show the defined routes :
site_get.0 GET ANY ANY /api/sites/{id}
site_get_with_locale.0 GET ANY ANY /api/{_locale}/sites/{id}
And the profiler routing section :
I also wrote a post on stackoverflow :
https://stackoverflow.com/questions/62934810/symfony-4-setting-locale-parameter-in-route-definition-leads-to-no-route-f