File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
src/Symfony/Component/Validator Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ class UrlValidator extends ConstraintValidator
24
24
{
25
25
const PATTERN = '~^
26
26
(%s):// # protocol
27
+ (([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth
27
28
(
28
29
([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
29
30
| # or
Original file line number Diff line number Diff line change @@ -116,6 +116,8 @@ public function getValidUrls()
116
116
array ('http://xn--espaa-rta.xn--ca-ol-fsay5a/ ' ),
117
117
array ('http://xn--d1abbgf6aiiy.xn--p1ai/ ' ),
118
118
array ('http://☎.com/ ' ),
119
+ array ('http://username:password@symfony.com ' ),
120
+ array ('http://user-name@symfony.com ' ),
119
121
);
120
122
}
121
123
@@ -155,6 +157,10 @@ public function getInvalidUrls()
155
157
array ('ftp://[::1]/ ' ),
156
158
array ('http://[::1 ' ),
157
159
array ('http://hello.☎/ ' ),
160
+ array ('http://:password@symfony.com ' ),
161
+ array ('http://:password@@symfony.com ' ),
162
+ array ('http://username:passwordsymfony.com ' ),
163
+ array ('http://usern@me:password@symfony.com ' ),
158
164
);
159
165
}
160
166
You can’t perform that action at this time.
0 commit comments