feature #30606 [Validator] allow brackets in the optional query string (Emmanuel BORGES)
This PR was squashed before being merged into the 4.3-dev branch (closes #30606).
Discussion
----------
[Validator] allow brackets in the optional query string
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30603
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Add the `allowBrackets` option from the Url constraint to allow brackets in the optional query string.
Commits
-------
40dc4c89df
[Validator] allow brackets in the optional query string
This commit is contained in:
commit
71c33c1531
@ -35,9 +35,9 @@ class UrlValidator extends ConstraintValidator
|
||||
\] # an IPv6 address
|
||||
)
|
||||
(:[0-9]+)? # a port (optional)
|
||||
(?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path
|
||||
(?:\? (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional)
|
||||
(?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional)
|
||||
(?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path
|
||||
(?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional)
|
||||
(?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional)
|
||||
$~ixu';
|
||||
|
||||
/**
|
||||
|
@ -151,6 +151,7 @@ class UrlValidatorTest extends ConstraintValidatorTestCase
|
||||
['http://symfony.com#fragment'],
|
||||
['http://symfony.com/#fragment'],
|
||||
['http://symfony.com/#one_more%20test'],
|
||||
['http://example.com/exploit.html?hello[0]=test'],
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user