We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc8447d commit 52e85cdCopy full SHA for 52e85cd
core-bundle/src/Resources/contao/dca/tl_page.php
@@ -1282,7 +1282,16 @@ public function loadDns($varValue)
1282
*/
1283
public function checkDns($varValue)
1284
{
1285
- return Idna::encode(preg_replace('#^(?:[a-z]+://)?([\pN\pL[\].:_-]+).*$#iu', '$1', $varValue));
+ if (!$varValue)
1286
+ {
1287
+ return '';
1288
+ }
1289
+
1290
+ // The first part will match IPv6 addresses in square brackets. The
1291
+ // second part will match domain names and IPv4 addresses.
1292
+ preg_match('#(?:^(?:[a-z]+]://)?(\[[0-9a-f:]+]))|(?:^(?:[a-z]+://)?([\pN\pL._-]*))#ui', $varValue, $matches);
1293
1294
+ return Idna::encode($matches[2] ?? $matches[1]);
1295
}
1296
1297
/**
0 commit comments