소스 검색

Suppress PHP notices in Predis\ConnectionCluster::getConnectionById() if the specified connection alias/index does not exist.

Daniele Alessandri 15 년 전
부모
커밋
69a0ed6d2f
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      lib/Predis.php

+ 2 - 1
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() {