Skip to content

Commit 68db340

Browse files
Merge branch '5.3' into 5.4
* 5.3: [Security] Do not overwrite already stored tokens for REMOTE_USER authentication [Validator] Fix validation for single level domains Fix redundant type casts Increased the reserved memory from 10k to 32k [DoctrineBridge] Add DbalLoggerTest to group legacy Leverage DBAL's getNativeConnection() method Fix idempotency of LocoProvider write method
2 parents e9ce9c7 + f3eeb40 commit 68db340

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Constraints/UrlValidator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ class UrlValidator extends ConstraintValidator
2525
(%s):// # protocol
2626
(((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+)@)? # basic auth
2727
(
28-
([\pL\pN\pS\-\_]+\.)*(([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
28+
(?:
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
32+
|
33+
[a-z0-9\-\_]++ # a single-level domain name
34+
)\.?
2935
| # or
3036
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
3137
| # or

Mapping/Loader/AbstractLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function addNamespaceAlias(string $alias, string $namespace)
6767
protected function newConstraint(string $name, $options = null)
6868
{
6969
if (str_contains($name, '\\') && class_exists($name)) {
70-
$className = (string) $name;
70+
$className = $name;
7171
} elseif (str_contains($name, ':')) {
7272
[$prefix, $className] = explode(':', $name, 2);
7373

Tests/Constraints/UrlValidatorTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ public function getValidUrls()
123123
['http://very.long.domain.name.com/'],
124124
['http://localhost/'],
125125
['http://myhost123/'],
126+
['http://internal-api'],
127+
['http://internal-api.'],
128+
['http://internal-api/'],
129+
['http://internal-api/path'],
126130
['http://127.0.0.1/'],
127131
['http://127.0.0.1:80/'],
128132
['http://[::1]/'],
@@ -169,6 +173,7 @@ public function getValidUrls()
169173
['http://symfony.com/#fragment'],
170174
['http://symfony.com/#one_more%20test'],
171175
['http://example.com/exploit.html?hello[0]=test'],
176+
['http://বিডিআইএ.বাংলা'],
172177
];
173178
}
174179

@@ -254,7 +259,14 @@ public function getInvalidUrls()
254259
['http://127.0.0.1:aa/'],
255260
['ftp://[::1]/'],
256261
['http://[::1'],
262+
['http://☎'],
263+
['http://☎.'],
264+
['http://☎/'],
265+
['http://☎/path'],
266+
['http://hello.☎'],
267+
['http://hello.☎.'],
257268
['http://hello.☎/'],
269+
['http://hello.☎/path'],
258270
['http://:[email protected]'],
259271
['http://:password@@symfony.com'],
260272
['http://username:passwordsymfony.com'],
@@ -271,6 +283,9 @@ public function getInvalidUrls()
271283
['http://.m.example.com'],
272284
['http://wwww.example..com'],
273285
['http://.www.example.com'],
286+
['http://example.co-'],
287+
['http://example.co-/path'],
288+
['http:///path'],
274289
];
275290
}
276291

0 commit comments

Comments
 (0)