8000 Don't call blindly the redis client · symfony/symfony@e4db018 · GitHub
[go: up one dir, main page]

Skip to content

Commit e4db018

Browse files
committed
Don't call blindly the redis client
1 parent 4927993 commit e4db018

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Symfony/Component/Lock/Store/RedisStore.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ private function evaluate($script, $resource, array $args)
130130
return $this->redis->_instance($this->redis->_target($resource))->eval($script, array_merge(array($resource), $args), 1);
131131
}
132132

133-
// Have to be a \Predis\Client
134-
return call_user_func_array(array($this->redis, 'eval'), array_merge(array($script, 1, $resource), $args));
133+
if ($this->redis instanceof \Predis\Client) {
134+
return call_user_func_array(array($this->redis, 'eval'), array_merge(array($script, 1, $resource), $args));
135+
}
136+
137+
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)));
135138
}
136139

137140
/**

0 commit comments

Comments
 (0)
0