[Validator] Allow underscore character "_" in URL username and password
This commit is contained in:
parent
59126e0f9c
commit
869518bc7e
@ -23,7 +23,7 @@ class UrlValidator extends ConstraintValidator
|
||||
{
|
||||
const PATTERN = '~^
|
||||
(%s):// # protocol
|
||||
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
|
||||
(([\_\.\pL\pN-]+:)?([\_\.\pL\pN-]+)@)? # basic auth
|
||||
(
|
||||
([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||
| # or
|
||||
|
@ -117,9 +117,11 @@ class UrlValidatorTest extends ConstraintValidatorTestCase
|
||||
['http://☎.com/'],
|
||||
['http://username:password@symfony.com'],
|
||||
['http://user.name:password@symfony.com'],
|
||||
['http://user_name:pass_word@symfony.com'],
|
||||
['http://username:pass.word@symfony.com'],
|
||||
['http://user.name:pass.word@symfony.com'],
|
||||
['http://user-name@symfony.com'],
|
||||
['http://user_name@symfony.com'],
|
||||
['http://symfony.com?'],
|
||||
['http://symfony.com?query=1'],
|
||||
['http://symfony.com/?query=1'],
|
||||
|
Reference in New Issue
Block a user