From e4db018b6d2708ecd08697cfb1c6bc39502423d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Wed, 22 Mar 2017 22:50:35 +0100 Subject: [PATCH] Don't call blindly the redis client --- src/Symfony/Component/Lock/Store/RedisStore.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php index 8674a1a142f23..b9ea2a5fb80e3 100644 --- a/src/Symfony/Component/Lock/Store/RedisStore.php +++ b/src/Symfony/Component/Lock/Store/RedisStore.php @@ -130,8 +130,11 @@ private function evaluate($script, $resource, array $args) return $this->redis->_instance($this->redis->_target($resource))->eval($script, array_merge(array($resource), $args), 1); } - // Have to be a \Predis\Client - return call_user_func_array(array($this->redis, 'eval'), array_merge(array($script, 1, $resource), $args)); + if ($this->redis instanceof \Predis\Client) { + return call_user_func_array(array($this->redis, 'eval'), array_merge(array($script, 1, $resource), $args)); + } + + throw new InvalidArgumentException(sprintf('%s() expects been initialized with a Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, is_object($this->redis) ? get_class($this->redis) : gettype($this->redis))); } /**