8000 Use immutable empty array in Redis::hKeys · phpredis/phpredis@3a2f3f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a2f3f4

Browse files
JakubOnderkamichael-grunder
authored andcommitted
Use immutable empty array in Redis::hKeys
1 parent 60b5a88 commit 3a2f3f4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,9 +3389,13 @@ redis_mbulk_reply_raw(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, zval
33893389
return FAILURE;
33903390
}
33913391
zval z_multi_result;
3392-
array_init_size(&z_multi_result, numElems); /* pre-allocate array for multi's results. */
33933392

3394-
redis_mbulk_reply_loop(redis_sock, &z_multi_result, numElems, UNSERIALIZE_NONE);
3393+
if (numElems < 1) {
3394+
ZVAL_EMPTY_ARRAY(&z_multi_result);
3395+
} else {
3396+
array_init_size(&z_multi_result, numElems); /* pre-allocate array for multi's results. */
3397+
redis_mbulk_reply_loop(redis_sock, &z_multi_result, numElems, UNSERIALIZE_NONE);
3398+
}
33953399

33963400
if (IS_ATOMIC(redis_sock)) {
33973401
RETVAL_ZVAL(&z_multi_result, 0, 1);

0 commit comments

Comments
 (0)
0