You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
As I mentioned here #40701 (comment). The problem not only in UrlGenerator. Router does not check important (I mean started with !) params inline requirements at all. I decided to open separate issue, because it could be more dangerous and it can be fixed separately.
How to reproduce
Create route with important param, and set some inline requirements like: #[Route('/foo/{!id<\d+>}')]
Open /foo/bar url and yes route matches the requirement
Symfony version(s) affected: 4.4 5.2?
Description
As I mentioned here #40701 (comment). The problem not only in UrlGenerator. Router does not check important (I mean started with
!
) params inline requirements at all. I decided to open separate issue, because it could be more dangerous and it can be fixed separately.How to reproduce
Create route with important param, and set some inline requirements like:
#[Route('/foo/{!id<\d+>}')]
Open
/foo/bar
url and yes route matches the requirementReason
symfony/src/Symfony/Component/Routing/RouteCompiler.php
Lines 125 to 128 in 1d8ad1d
$varName does not start with
!
symfony/src/Symfony/Component/Routing/RouteCompiler.php
Line 162 in 1d8ad1d
However Route requirement key starts with
!
, and param requirement set do default regex like[^/]++
Possible Solution
symfony/src/Symfony/Component/Routing/Route.php
Lines 536 to 552 in 1d8ad1d
Do not include
!
in requirement key.However it does not fix defaults for UrlGenerator described here #40701
The text was updated successfully, but these errors were encountered: