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 66e2cb6

Browse filesBrowse files
committed
[Validator] Accept underscores in the URL validator as the URL will resolve correctly
1 parent bbff632 commit 66e2cb6
Copy full SHA for 66e2cb6

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
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
@@ -25,7 +25,7 @@ class UrlValidator extends ConstraintValidator
2525
(%s):// # protocol
2626
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
2727
(
28-
([\pL\pN\pS\-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
28+
([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
2929
| # or
3030
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
3131
| # or

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public function getValidUrls()
7474
['http://www.google.museum'],
7575
['https://google.com/'],
7676
['https://google.com:80/'],
77+
['http://goog_le.com'],
78+
['http://www.sub_domain.goog_le.com'],
7779
['http://www.example.coop/'],
7880
['http://www.test-example.com/'],
7981
['http://www.symfony.com/'],
@@ -154,7 +156,6 @@ public function getInvalidUrls()
154156
['://google.com'],
155157
['http ://google.com'],
156158
['http:/google.com'],
157-
['http://goog_le.com'],
158159
['http://google.com::aa'],
159160
['http://google.com:aa'],
160161
['ftp://google.fr'],

0 commit comments

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