diff --git a/app/Status.php b/app/Status.php index 7893aae..c0c1670 100644 --- a/app/Status.php +++ b/app/Status.php @@ -52,13 +52,17 @@ class Status { $this->state = static::FAIL; - $sock = Net::detectIPVersion( - $this->address[0] === '[' && $this->address[strlen($this->address) - 1] === ']' - ? substr($this->address, 1, -1) - : $this->address - ) !== 0 || dns_get_record($this->address, DNS_A | DNS_A6 | DNS_MX) - ? fsockopen($this->address, $this->port, $errno, $errstr, 1) - : false; + try { + $sock = Net::detectIPVersion( + $this->address[0] === '[' && $this->address[strlen($this->address) - 1] === ']' + ? substr($this->address, 1, -1) + : $this->address + ) !== 0 || dns_get_record($this->address, DNS_A | DNS_A6 | DNS_MX) + ? fsockopen($this->address, $this->port, $errno, $errstr, 1) + : false; + } catch (\ErrorException $e) { + $sock = false; + } if ($sock !== false) { fclose($sock);