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 26d4db3

Browse filesBrowse files
committed
bug #10275 [Validator] Fixed ACE domain checks on UrlValidator (#10031) (aeoris)
This PR was merged into the 2.3 branch. Discussion ---------- [Validator] Fixed ACE domain checks on UrlValidator (#10031) | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10031 | License | MIT | Doc PR | I added some checks to allow internationalised domain names as per reported on #10031 and some extra testcases to cover ACE domain names. Commits ------- 7a2f154 Fixed ACE domain checks on UrlValidator (#10031)
2 parents 22caebc + 7a2f154 commit 26d4db3
Copy full SHA for 26d4db3

File tree

Expand file treeCollapse file tree

2 files changed

+14
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-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
@@ -25,7 +25,7 @@ class UrlValidator extends ConstraintValidator
2525
const PATTERN = '~^
2626
(%s):// # protocol
2727
(
28-
([\pL\pN\pS-]+\.)+[\pL]+ # a domain name
28+
([\pL\pN\pS-]+\.)+([\pL]|xn\-\-[\pL\pN-]+)+ # a domain name
2929
| # or
3030
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a 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
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,28 @@ public function getValidUrls()
9191
array('http://[::1]:80/'),
9292
array('http://[1:2:3::4:5:6:7]/'),
9393
array('http://sãopaulo.com/'),
94+
array('http://xn--sopaulo-xwa.com/'),
9495
array('http://sãopaulo.com.br/'),
96+
array('http://xn--sopaulo-xwa.com.br/'),
9597
array('http://пример.испытание/'),
98+
array('http://xn--e1afmkfd.xn--80akhbyknj4f/'),
9699
array('http://مثال.إختبار/'),
100+
array('http://xn--mgbh0fb.xn--kgbechtv/'),
97101
array('http://例子.测试/'),
102+
array('http://xn--fsqu00a.xn--0zwm56d/'),
98103
array('http://例子.測試/'),
104+
array('http://xn--fsqu00a.xn--g6w251d/'),
99105
array('http://例え.テスト/'),
106+
array('http://xn--r8jz45g.xn--zckzah/'),
100107
array('http://مثال.آزمایشی/'),
108+
array('http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'),
101109
array('http://실례.테스트/'),
110+
array('http://xn--9n2bp8q.xn--9t4b11yi5a/'),
102111
array('http://العربية.idn.icann.org/'),
112+
array('http://xn--ogb.idn.icann.org/'),
113+
array('http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'),
114+
array('http://xn--espaa-rta.xn--ca-ol-fsay5a/'),
115+
array('http://xn--d1abbgf6aiiy.xn--p1ai/'),
103116
array('http://☎.com/'),
104117
);
105118
}

0 commit comments

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