mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-31 07:01:54 +00:00
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:
parent
3681b9b76a
commit
919005c0f8
@ -452,9 +452,9 @@ class Validator
|
|||||||
{
|
{
|
||||||
foreach ($this->validUrlPrefixes as $prefix) {
|
foreach ($this->validUrlPrefixes as $prefix) {
|
||||||
if (strpos($value, $prefix) !== false) {
|
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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user