From 29959904b0c0cc5c958a3ba398a10864ac5e3fd6 Mon Sep 17 00:00:00 2001 From: Sergii Smirnov Date: Thu, 25 Feb 2016 23:42:28 +0200 Subject: [PATCH] Fixed E_WARNING message when NSQ is unavailable If NSQ is unavailable and error reporting E_WARNING is enabled, ConnectionException is thrown successfully. --- src/nsqphp/Connection/Connection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nsqphp/Connection/Connection.php b/src/nsqphp/Connection/Connection.php index 6a49e6d..203d265 100644 --- a/src/nsqphp/Connection/Connection.php +++ b/src/nsqphp/Connection/Connection.php @@ -215,7 +215,7 @@ public function write($buf) public function getSocket() { if ($this->socket === NULL) { - $this->socket = fsockopen($this->hostname, $this->port, $errNo, $errStr, $this->connectionTimeout); + $this->socket = @fsockopen($this->hostname, $this->port, $errNo, $errStr, $this->connectionTimeout); if ($this->socket === FALSE) { throw new ConnectionException( "Could not connect to {$this->hostname}:{$this->port} ({$errStr} [{$errNo}])" @@ -242,4 +242,4 @@ public function __toString() { return "{$this->hostname}:{$this->port}"; } -} \ No newline at end of file +}