Skip to content

Commit 20f555e

Browse files
committed
Copy zval in multi/exec/pipe forwarded array calls
* Addresses GitHub issue phpredis#262 * Tested successfully with code provided by bug reporter * array-tests.php passes
1 parent 7dfac44 commit 20f555e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

redis_array.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,12 @@ PHP_METHOD(RedisArray, setOption)
700700
/* copy all args into a zval hash table */\
701701
array_init(&z_arg_array);\
702702
for(i = 0; i < num_varargs; ++i) {\
703-
add_next_index_zval(&z_arg_array, *varargs[i]);\
703+
zval *z_tmp;\
704+
MAKE_STD_ZVAL(z_tmp);\
705+
*z_tmp = **varargs[i];\
706+
zval_copy_ctor(z_tmp);\
707+
INIT_PZVAL(z_tmp);\
708+
add_next_index_zval(&z_arg_array, z_tmp);\
704709
}\
705710
/* call */\
706711
ra_forward_call(INTERNAL_FUNCTION_PARAM_PASSTHRU, ra, cmd, sizeof(cmd)-1, &z_arg_array, NULL);\

0 commit comments

Comments
 (0)