bug #34832 [3.4][Validator] Allow underscore character "_" in URL username and password (romainneutron)
This PR was merged into the 3.4 branch.
Discussion
----------
[3.4][Validator] Allow underscore character "_" in URL username and password
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
Hello!
It's been a long time since my last push on Symfony :)
Here's a bug fix. I think URL usernames and password may contain an underscore. Let me know!
Commits
-------
869518bc7e
[Validator] Allow underscore character "_" in URL username and password
This commit is contained in:
commit
ffcb691698
@ -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