Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Calling zRevRangeByScore with limit options set would cause notice error in the logger #63

Merged
merged 1 commit into from

3 participants

@modi

error:

Notice: Array to string conversion in /home/modi/Projects/dalvshi/vendor/snc/redis-bundle/Snc/RedisBundle/Client/Phpredis/Client.php line 106

It seems I add a lot of code for a small change.

@travisbot

This pull request passes (merged 66aaa82 into 3989213).

@snc snc merged commit c512625 into snc:master
@snc
Owner

Merged into both branches. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 13, 2012
  1. Fix: arguments of dimension higher than 2 cause notice level error in…

    Mo Di authored
    … command logging.
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 1 deletion.
  1. +25 −1 Client/Phpredis/Client.php
View
26 Client/Phpredis/Client.php
@@ -103,6 +103,30 @@ public function __call($name, array $arguments)
*/
private function getCommandString($command, array $arguments)
{
- return trim(strtoupper($command) . ' ' . implode(' ', (array) array_pop($arguments)));
+ $list = array();
+ $this->flatten($arguments, $list);
+
+ return trim(strtoupper($command) . ' ' . implode(' ', $list));
+ }
+
+ /**
+ * Flatten arguments to single dimension array
+ *
+ * @param array $arguments An array of command arguments
+ * @param array $list Holder of results
+ */
+ private function flatten($arguments, array &$list)
+ {
+ foreach ($arguments as $key => $item) {
+ if (!is_numeric($key)) {
+ $list[] = $key;
+ }
+
+ if (is_scalar($item)) {
+ $list[] = strval($item);
+ } else {
+ $this->flatten($item, $list);
+ }
+ }
}
}
Something went wrong with that request. Please try again.