8000 Ignore OPT_PREFIX for a timeout argument · jrtkcoder/phpredis@70430fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 70430fb

Browse files
Ignore OPT_PREFIX for a timeout argument
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 phpredis#158
1 parent 3a3ee37 commit 70430fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

redis.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,7 +2422,10 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
24222422
keys[j] = Z_STRVAL_P(z_args[i]);
24232423
keys_len[j] = Z_STRLEN_P(z_args[i]);
24242424

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

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

0 commit comments

Comments
 (0)
0