@@ -2270,12 +2270,12 @@ PHP_METHOD(Redis, sMembers)
22702270PHPAPI int generic_multiple_args_cmd (INTERNAL_FUNCTION_PARAMETERS , char * keyword , int keyword_len ,
22712271 int min_argc , RedisSock * * out_sock , int has_timeout , int all_keys , int can_serialize )
22722272{
2273- zval * object , * * z_args , * z_array ;
2273+ zval * * z_args , * z_array ;
22742274 char * * keys , * cmd ;
22752275 int cmd_len , * keys_len , * keys_to_free ;
22762276 int i , j , argc = ZEND_NUM_ARGS (), real_argc = 0 ;
22772277 int single_array = 0 ;
2278- int timeout ;
2278+ int timeout = 0 ;
22792279 int pos ;
22802280 int array_size ;
22812281
@@ -2347,10 +2347,9 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
23472347 char * key ;
23482348 unsigned int key_len ;
23492349 unsigned long idx ;
2350- int type ;
23512350 zval * * z_value_pp ;
23522351
2353- type = zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
2352+ zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
23542353 if (zend_hash_get_current_data (keytable , (void * * )& z_value_pp ) == FAILURE ) {
23552354 continue ; /* this should never happen, according to the PHP people. */
23562355 }
@@ -2392,12 +2391,7 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
23922391 real_argc ++ ;
23932392 }
23942393 } else {
2395- int nb_keys ;
2396- if (!has_timeout ) {
2397- nb_keys = argc ;
2398- } else if (has_timeout && Z_TYPE_P (z_args [argc - 1 ]) == IS_LONG ) {
2399- nb_keys = argc - 1 ;
2400- } else {
2394+ if (has_timeout && Z_TYPE_P (z_args [argc - 1 ]) != IS_LONG ) {
24012395 php_error_docref (NULL TSRMLS_CC , E_ERROR , "Syntax error on timeout" );
24022396 }
24032397
@@ -2465,7 +2459,6 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
24652459
24662460 if (z_args ) efree (z_args );
24672461
2468- object = getThis ();
24692462 /*
24702463 cmd[cmd_len] = 0;
24712464 php_printf("cmd=[%s]\n", cmd);
@@ -2703,10 +2696,9 @@ PHP_METHOD(Redis, sort) {
27032696 char * key ;
27042697 unsigned int key_len ;
27052698 unsigned long idx ;
2706- int type ;
27072699 zval * * z_value_pp ;
27082700
2709- type = zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
2701+ zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
27102702 if (zend_hash_get_current_data (keytable , (void * * )& z_value_pp ) == FAILURE ) {
27112703 continue ; /* this should never happen, according to the PHP people. */
27122704 }
@@ -3441,7 +3433,7 @@ generic_mset(INTERNAL_FUNCTION_PARAMETERS, char *kw, void (*fun)(INTERNAL_FUNCTI
34413433 zval * object ;
34423434 RedisSock * redis_sock ;
34433435
3444- char * cmd , * p ;
3436+ char * cmd = NULL , * p = NULL ;
34453437 int cmd_len = 0 , argc = 0 , kw_len = strlen (kw );
34463438 int step = 0 ; // 0: compute size; 1: copy strings.
34473439 zval * z_array ;
@@ -4205,7 +4197,7 @@ PHP_METHOD(Redis, zIncrBy)
42054197PHPAPI void generic_z_command (INTERNAL_FUNCTION_PARAMETERS , char * command , int command_len ) {
42064198
42074199 zval * object , * keys_array , * weights_array = NULL , * * data ;
4208- HashTable * arr_weights_hash , * arr_keys_hash ;
4200+ HashTable * arr_weights_hash = NULL , * arr_keys_hash ;
42094201 int key_output_len , array_weights_count , array_keys_count , operation_len = 0 ;
42104202 char * key_output , * operation ;
42114203 RedisSock * redis_sock ;
@@ -4655,12 +4647,11 @@ PHPAPI void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab, int
46554647
46564648 char * tablekey , * hkey , * hval ;
46574649 unsigned int tablekey_len ;
4658- int hkey_len , hval_len ;
4650+ int hkey_len ;
46594651 unsigned long idx ;
4660- int type ;
46614652 zval * * z_key_pp , * * z_value_pp ;
46624653
4663- type = zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
4654+ zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
46644655 if (zend_hash_get_current_data (keytable , (void * * )& z_key_pp ) == FAILURE ) {
46654656 continue ; /* this should never happen, according to the PHP people. */
46664657 }
@@ -4674,14 +4665,13 @@ PHPAPI void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab, int
46744665 zend_hash_move_forward (keytable );
46754666
46764667 /* fetch again */
4677- type = zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
4668+ zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
46784669 if (zend_hash_get_current_data (keytable , (void * * )& z_value_pp ) == FAILURE ) {
46794670 continue ; /* this should never happen, according to the PHP people. */
46804671 }
46814672
46824673 /* get current value, a hash value now. */
46834674 hval = Z_STRVAL_PP (z_value_pp );
4684- hval_len = Z_STRLEN_PP (z_value_pp );
46854675
46864676 if (use_atof ) { /* zipping a score */
46874677 add_assoc_double_ex (z_ret , hkey , 1 + hkey_len , atof (hval ));
@@ -5298,10 +5288,9 @@ PHP_METHOD(Redis, subscribe)
52985288 zval * z_tab , * * tmp ;
52995289 char * type_response ;
53005290
5301- int callback_type ;
5302- zval * z_o , * z_fun ,* z_ret , * z_args [3 ];
5291+ int callback_type = 0 ;
5292+ zval * z_o , * z_fun = NULL ,* z_ret , * z_args [3 ];
53035293 char * method_name ;
5304- zend_class_entry * ce ;
53055294
53065295 if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Oaz|z" ,
53075296 & object , redis_ce , & array , & z_callback ) == FAILURE ) {
@@ -5387,6 +5376,8 @@ PHP_METHOD(Redis, subscribe)
53875376 callback_ft_name = Z_STRVAL_P (z_callback );
53885377 callback_ft_name_len = strlen (callback_ft_name );
53895378 callback_type = R_SUB_CALLBACK_FT_TYPE ;
5379+ MAKE_STD_ZVAL (z_fun );
5380+ ZVAL_STRINGL (z_fun , callback_ft_name , callback_ft_name_len , 0 );
53905381 }
53915382
53925383 /* Multibulk Response, format : {message type, originating channel, message payload} */
@@ -5421,14 +5412,12 @@ PHP_METHOD(Redis, subscribe)
54215412 switch (callback_type ) {
54225413 case R_SUB_CALLBACK_CLASS_TYPE :
54235414 MAKE_STD_ZVAL (z_ret );
5424- call_user_function (& ce -> function_table , & z_o , z_fun , z_ret , 3 , z_args TSRMLS_CC );
5415+ call_user_function (& redis_ce -> function_table , & z_o , z_fun , z_ret , 3 , z_args TSRMLS_CC );
54255416 efree (z_ret );
54265417 break ;
54275418
54285419 case R_SUB_CALLBACK_FT_TYPE :
54295420 MAKE_STD_ZVAL (z_ret );
5430- MAKE_STD_ZVAL (z_fun );
5431- ZVAL_STRINGL (z_fun , callback_ft_name , callback_ft_name_len , 0 );
54325421 call_user_function (EG (function_table ), NULL , z_fun , z_ret , 3 , z_args TSRMLS_CC );
54335422 efree (z_fun );
54345423 efree (z_ret );
0 commit comments