[Validator] allow brackets in the optional query string
This commit is contained in:
parent
19c6639452
commit
40dc4c89df
@ -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