From 5d99914939e08bdfd3525f963665966a41d7b929 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sun, 15 May 2016 16:54:57 +0200 Subject: [PATCH] Prevent warnings picking slave from empty pool. --- src/Connection/Aggregate/MasterSlaveReplication.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Connection/Aggregate/MasterSlaveReplication.php b/src/Connection/Aggregate/MasterSlaveReplication.php index ea5dc775..de7494df 100644 --- a/src/Connection/Aggregate/MasterSlaveReplication.php +++ b/src/Connection/Aggregate/MasterSlaveReplication.php @@ -207,7 +207,9 @@ class MasterSlaveReplication implements ReplicationInterface */ protected function pickSlave() { - return $this->slaves[array_rand($this->slaves)]; + if ($this->slaves) { + return $this->slaves[array_rand($this->slaves)]; + } } /**