Skip to content

Commit

Permalink
Improve the regex
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Auswöger <martin@auswoeger.com>
  • Loading branch information
leofeyer and ausi committed Dec 10, 2020
1 parent 52e85cd commit 48a0c3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core-bundle/src/Resources/contao/dca/tl_page.php
Expand Up @@ -1289,9 +1289,9 @@ public function checkDns($varValue)

// The first part will match IPv6 addresses in square brackets. The
// second part will match domain names and IPv4 addresses.
preg_match('#(?:^(?:[a-z]+]://)?(\[[0-9a-f:]+]))|(?:^(?:[a-z]+://)?([\pN\pL._-]*))#ui', $varValue, $matches);
preg_match('#^(?:[a-z]+://)?(\[[0-9a-f:]+]|[\pN\pL._-]*)#ui', $varValue, $matches);

return Idna::encode($matches[2] ?? $matches[1]);
return Idna::encode($matches[1]);
}

/**
Expand Down

0 comments on commit 48a0c3c

Please sign in to comment.