Skip to content

Commit 06b42f1

Browse files
Merge branch '7.2' into 7.3
* 7.2: Update validators.pt.xlf bug #59196 [Config] ResourceCheckerConfigCache metadata unserialize emits warning fix(validator): only check for puny code in tld
2 parents 90190df + 836ced0 commit 06b42f1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Constraints/UrlValidator.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ class UrlValidator extends ConstraintValidator
2626
(((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+)@)? # basic auth
2727
(
2828
(?:
29-
(?:xn--[a-z0-9-]++\.)*+xn--[a-z0-9-]++ # a domain name using punycode
30-
|
31-
(?:[\pL\pN\pS\pM\-\_]++\.)+[\pL\pN\pM]++ # a multi-level domain name
29+
(?:
30+
(?:[\pL\pN\pS\pM\-\_]++\.)+
31+
(?:
32+
(?:xn--[a-z0-9-]++) # punycode in tld
33+
|
34+
(?:[\pL\pN\pM]++) # no punycode in tld
35+
)
36+
) # a multi-level domain name
3237
|
3338
[a-z0-9\-\_]++ # a single-level domain name
3439
)\.?

Tests/Constraints/UrlValidatorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ public static function getValidUrls()
188188
['http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'],
189189
['http://xn--espaa-rta.xn--ca-ol-fsay5a/'],
190190
['http://xn--d1abbgf6aiiy.xn--p1ai/'],
191+
['http://example.xn--p1ai/'],
192+
['http://xn--d1abbgf6aiiy.example.xn--p1ai/'],
191193
['http://☎.com/'],
192194
['http://username:[email protected]'],
193195
['http://user.name:[email protected]'],

0 commit comments

Comments
 (0)