Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 074539d

Browse filesBrowse files
sidzfabpot
authored andcommitted
Fix Url Validator false positives
1 parent c71e9ba commit 074539d
Copy full SHA for 074539d

File tree

2 files changed

+6
-1
lines changed
Filter options

2 files changed

+6
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/UrlValidator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UrlValidator extends ConstraintValidator
2626
(%s):// # protocol
2727
(((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+)@)? # basic auth
2828
(
29-
([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
29+
([\pL\pN\pS]+\.?[\pL\pN\pS\-\_]+)+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
3030
| # or
3131
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
3232
| # or

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function getValidUrls()
105105
return [
106106
['http://a.pl'],
107107
['http://www.example.com'],
108+
['http://tt.example.com'],
108109
['http://www.example.com.'],
109110
['http://www.example.museum'],
110111
['https://example.com/'],
@@ -265,6 +266,10 @@ public function getInvalidUrls()
265266
['http://example.com/exploit.html?hel lo'],
266267
['http://example.com/exploit.html?not_a%hex'],
267268
['http://'],
269+
['http://www..com'],
270+
['http://www..example.com'],
271+
['http://wwww.example..com'],
272+
['http://.www.example.com'],
268273
];
269274
}
270275

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.