Fix validateUrlActive() to check host part of URL for correct DNS records

validateUrlActive() calls checkdnsrr() which by default looks only for MX records, and passes the whole tail part of the URL after the prefix. It should isolate the host and check for A, AAAA or CNAME DNS records.
This commit is contained in:
Alexandros Diamantidis 2015-09-17 13:32:20 +03:00
parent 3681b9b76a
commit 919005c0f8

View File

@ -452,9 +452,9 @@ class Validator
{
foreach ($this->validUrlPrefixes as $prefix) {
if (strpos($value, $prefix) !== false) {
$url = str_replace($prefix, '', strtolower($value));
$host = parse_url(strtolower($value), PHP_URL_HOST);
return checkdnsrr($url);
return checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA') || checkdnsrr($host, 'CNAME');
}
}