Skip to content

Commit

Permalink
Ignore OPT_PREFIX for a timeout argument
Browse files Browse the repository at this point in the history
When arguments were passed in the form ($key1, $key2, ...) to BLPOP
or BRPOP with a prefix, the timeout value was also being prefixed
causing it to misbehave.

Now for these commands we ignore the prefix on our timeout argument

Fixes issue #158
  • Loading branch information
michael-grunder committed Oct 22, 2012
1 parent 3a3ee37 commit 70430fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion redis.c
Expand Up @@ -2422,7 +2422,10 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
keys[j] = Z_STRVAL_P(z_args[i]);
keys_len[j] = Z_STRLEN_P(z_args[i]);

keys_to_free[j] = redis_key_prefix(redis_sock, &keys[j], &keys_len[j] TSRMLS_CC); /* add optional prefix TSRMLS_CC*/
// If we have a timeout it should be the last argument, which we do not want to prefix
if(!has_timeout || i < argc-1) {
keys_to_free[j] = redis_key_prefix(redis_sock, &keys[j], &keys_len[j] TSRMLS_CC); /* add optional prefix TSRMLS_CC*/
}
}

cmd_len += 1 + integer_length(keys_len[j]) + 2 + keys_len[j] + 2; /* $ + size + NL + string + NL */
Expand Down

0 comments on commit 70430fb

Please sign in to comment.