Closed
Description
Symfony version(s) affected
5.4.8
Description
This is odd and I'm sure this is not the way to go.
When navigating to a route with an optional parameter that has the "!" character (which means the default value will always be included in the generate function) you're required to pass that default parameter when navigating to it.
Which means the optional parameter doesn't have any purpose. As you're required to type it or it throws a ResourceNotFoundException
How to reproduce
Using the example from the announcement blogpost
- Define the route
/**
* @Route("/blog/{!page}", name="blog_list")
*/
public function list($page = 1)
{
// ...
}
- Go to /blog
- Have a ResourceNotFoundException
- /blog/1 does work but default parameter loses its purpose
Possible Solution
No response
Additional Context
No response