fix exception in status checking code

This commit is contained in:
flash 2016-12-11 15:49:03 +01:00
parent 9a5a559e10
commit b56a95fecc

View file

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