You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hit an issue today where the DNS validation wasn't working. It looks like there is a bug in alpine Linux (I was using the php:7.4-fpm-alpine docker image), which means checkdnsrr returns true even if the domain doesn't exist. See the bug reports below:
Whilst I appreciate this is not a bug in this library, I wonder if it might be worth switching to dns_get_record in DNSCheckValidation instead, which is unaffected, allows us the same validation and was also somewhat faster in my tests.
dns_get_record returns an array or false, so the equivalent implementation would just be to do something like $MXresult = !empty(dns_get_record($host, DNS_MX));
Another benefit to this approach would be handling the "Null MX" case RFC 7505.
checkdnsrr('example.com.', 'MX') returns bool(true) as the MX record exists. As there is no target, it should be considered invalid and return false. dns_get_record() returns the DNS records, so we can simply validate that a) there is an MX record and b) it is a valid record.
Hi @BenHarris ,
Thanks for informing about this issue.
I see the benefits you state and i'd be a great improvement for that validation.
I encourage you to do the change and send a PR ;), I will be more than happy to review and merge.
I hit an issue today where the DNS validation wasn't working. It looks like there is a bug in alpine Linux (I was using the php:7.4-fpm-alpine docker image), which means checkdnsrr returns true even if the domain doesn't exist. See the bug reports below:
Whilst I appreciate this is not a bug in this library, I wonder if it might be worth switching to dns_get_record in DNSCheckValidation instead, which is unaffected, allows us the same validation and was also somewhat faster in my tests.
dns_get_record returns an array or false, so the equivalent implementation would just be to do something like
$MXresult = !empty(dns_get_record($host, DNS_MX));
Invalid domain test
checkdnsrr('notavaliddomain.c2.', 'MX')
dns_get_record('notavaliddomain.d2.', DNS_MX)
Valid domain
checkdnsrr('google.com.', 'MX')
dns_get_record('google.com.', DNS_MX)
The text was updated successfully, but these errors were encountered: