catch exception thrown by new IdnaConverter when encoding a non-valid domain, fixes #1678
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -37,7 +37,11 @@ function validateUrl($url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// needs converting
|
// needs converting
|
||||||
$url = $idna_convert->encode($url);
|
try {
|
||||||
|
$url = $idna_convert->encode($url);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$pattern = "/^https?:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,4}(\:[0-9]+)?\/?(.+)?$/i";
|
$pattern = "/^https?:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,4}(\:[0-9]+)?\/?(.+)?$/i";
|
||||||
if (preg_match($pattern, $url)) {
|
if (preg_match($pattern, $url)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user