fix exception in status checking code
This commit is contained in:
parent
9a5a559e10
commit
b56a95fecc
1 changed files with 11 additions and 7 deletions
|
@ -52,6 +52,7 @@ class Status
|
||||||
{
|
{
|
||||||
$this->state = static::FAIL;
|
$this->state = static::FAIL;
|
||||||
|
|
||||||
|
try {
|
||||||
$sock = Net::detectIPVersion(
|
$sock = Net::detectIPVersion(
|
||||||
$this->address[0] === '[' && $this->address[strlen($this->address) - 1] === ']'
|
$this->address[0] === '[' && $this->address[strlen($this->address) - 1] === ']'
|
||||||
? substr($this->address, 1, -1)
|
? substr($this->address, 1, -1)
|
||||||
|
@ -59,6 +60,9 @@ class Status
|
||||||
) !== 0 || dns_get_record($this->address, DNS_A | DNS_A6 | DNS_MX)
|
) !== 0 || dns_get_record($this->address, DNS_A | DNS_A6 | DNS_MX)
|
||||||
? fsockopen($this->address, $this->port, $errno, $errstr, 1)
|
? fsockopen($this->address, $this->port, $errno, $errstr, 1)
|
||||||
: false;
|
: false;
|
||||||
|
} catch (\ErrorException $e) {
|
||||||
|
$sock = false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($sock !== false) {
|
if ($sock !== false) {
|
||||||
fclose($sock);
|
fclose($sock);
|
||||||
|
|
Reference in a new issue