From c6f81be89d0fa654605e48dad43a3f459675ce11 Mon Sep 17 00:00:00 2001 From: Sergey Smirnov Date: Tue, 15 Mar 2016 14:14:24 +0200 Subject: [PATCH] Fixed fsockopen warning message if socket is unavailable. Throwing ConnectionException successfully in this case. --- src/nsqphp/Connection/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nsqphp/Connection/Connection.php b/src/nsqphp/Connection/Connection.php index 6a49e6d..e6f20bb 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}])"