From 69a0ed6d2ff80ff25f9a00c9ce7b10ff93d50abc Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 22 May 2010 12:27:14 +0200 Subject: [PATCH] Suppress PHP notices in Predis\ConnectionCluster::getConnectionById() if the specified connection alias/index does not exist. --- lib/Predis.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Predis.php b/lib/Predis.php index 2723c249..daca16ca 100644 --- a/lib/Predis.php +++ b/lib/Predis.php @@ -1295,7 +1295,8 @@ class ConnectionCluster implements IConnection, \IteratorAggregate { } public function getConnectionById($id = null) { - return $this->_pool[$id ?: 0]; + $alias = $id ?: 0; + return isset($this->_pool[$alias]) ? $this->_pool[$alias] : null; } public function getIterator() {