Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40dc4c8

Browse files
Emmanuel BORGESfabpot
Emmanuel BORGES
authored andcommitted
[Validator] allow brackets in the optional query string
1 parent 19c6639 commit 40dc4c8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Symfony/Component/Validator/Constraints/UrlValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class UrlValidator extends ConstraintValidator
3535
\] # an IPv6 address
3636
)
3737
(:[0-9]+)? # a port (optional)
38-
(?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path
39-
(?:\? (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional)
40-
(?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional)
38+
(?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path
39+
(?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional)
40+
(?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional)
4141
$~ixu';
4242

4343
/**

src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public function getValidUrls()
151151
['http://symfony.com#fragment'],
152152
['http://symfony.com/#fragment'],
153153
['http://symfony.com/#one_more%20test'],
154+
['http://example.com/exploit.html?hello[0]=test'],
154155
];
155156
}
156157

0 commit comments

Comments
 (0)