diff --git a/src/Validation/DNSGetRecordWrapper.php b/src/Validation/DNSGetRecordWrapper.php index 5d04c01..f52b6cb 100644 --- a/src/Validation/DNSGetRecordWrapper.php +++ b/src/Validation/DNSGetRecordWrapper.php @@ -12,19 +12,7 @@ class DNSGetRecordWrapper */ public function getRecords(string $host, int $type): DNSRecords { - // A workaround to fix https://bugs.php.net/bug.php?id=73149 - set_error_handler( - static function (int $errorLevel, string $errorMessage): never { - throw new \RuntimeException("Unable to get DNS record for the host: $errorMessage"); - } - ); - try { - // Get all MX, A and AAAA DNS records for host - return new DNSRecords(dns_get_record($host, $type)); - } catch (\RuntimeException $exception) { - return new DNSRecords([], true); - } finally { - restore_error_handler(); - } + $result = @dns_get_record($host, $type); + return new DNSRecords($result === false ? [] : $result, $result === false); } }