Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2eb5c97

Browse filesBrowse files
committed
minor #22117 [Lock] Don't call blindly the redis client (jderusse)
This PR was merged into the 3.3-dev branch. Discussion ---------- [Lock] Don't call blindly the redis client | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Actual code rely on controls on the constructor. This PR add an assertion to avoid futur bugs Commits ------- e4db018 Don't call blindly the redis client
2 parents f876e58 + e4db018 commit 2eb5c97
Copy full SHA for 2eb5c97

File tree

1 file changed

+5
-2
lines changed
Filter options

1 file changed

+5
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/RedisStore.php
+5-2Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.