@@ -1220,7 +1220,7 @@ static void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab,
12201220        unsigned long  idx ;
12211221        zval  * z_key_p , * z_value_p ;
12221222
1223-         zend_hash_get_current_key_ex (keytable , & tablekey , & idx ,  0 );
1223+         zend_hash_get_current_key (keytable , & tablekey , & idx );
12241224        if ((z_key_p  =  zend_hash_get_current_data (keytable )) ==  NULL ) {
12251225            continue ;   /* this should never happen, according to the PHP people. */ 
12261226        }
@@ -1234,7 +1234,7 @@ static void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab,
12341234        zend_hash_move_forward (keytable );
12351235
12361236        /* fetch again */ 
1237-         zend_hash_get_current_key_ex (keytable , & tablekey , & idx ,  0 );
1237+         zend_hash_get_current_key (keytable , & tablekey , & idx );
12381238        if ((z_value_p  =  zend_hash_get_current_data (keytable )) ==  NULL ) {
12391239            continue ;   /* this should never happen, according to the PHP people. */ 
12401240        }
@@ -1244,13 +1244,13 @@ static void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab,
12441244
12451245        /* Decode the score depending on flag */ 
12461246        if  (decode  ==  SCORE_DECODE_INT  &&  Z_STRLEN_P (z_value_p ) >  0 ) {
1247-             add_assoc_long_ex (& z_ret , hkey , 1 + hkey_len , atoi (hval + 1 ));
1247+             add_assoc_long_ex (& z_ret , hkey , hkey_len , atoi (hval + 1 ));
12481248        } else  if  (decode  ==  SCORE_DECODE_DOUBLE ) {
1249-             add_assoc_double_ex (& z_ret , hkey , 1 + hkey_len , atof (hval ));
1249+             add_assoc_double_ex (& z_ret , hkey , hkey_len , atof (hval ));
12501250        } else  {
12511251            zval  z ;
12521252			ZVAL_DUP (& z , z_value_p );
1253-             add_assoc_zval_ex (& z_ret , hkey , 1 + hkey_len , & z );
1253+             add_assoc_zval_ex (& z_ret , hkey , hkey_len , & z );
12541254        }
12551255    }
12561256
@@ -1391,12 +1391,12 @@ PHP_REDIS_API void redis_string_response(INTERNAL_FUNCTION_PARAMETERS, RedisSock
13911391        RETURN_FALSE ;
13921392    }
13931393    IF_MULTI_OR_PIPELINE () {
1394-         zval  * z   =   NULL ;
1395-          if ( redis_unserialize ( redis_sock ,  response ,  response_len , 
1396-                               & z   TSRMLS_CC ) ==  1 )
1394+         zval  z ,  * z_p ;
1395+ 		 z_p   =   & z ; 
1396+         if ( redis_unserialize ( redis_sock ,  response ,  response_len ,  & z_p ) ==  1 )
13971397        {
13981398            efree (response );
1399-             add_next_index_zval (z_tab , z );
1399+             add_next_index_zval (z_tab , z_p );
14001400        } else  {
14011401            add_next_index_stringl (z_tab , response , response_len );
14021402        }
@@ -1432,9 +1432,8 @@ redis_ping_response(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
14321432    IF_MULTI_OR_PIPELINE () {
14331433        add_next_index_stringl (z_tab , response , response_len );
14341434    } else  {
1435-         RETURN_STRINGL (response ,  response_len );
1435+         RETURN_STRING (response );
14361436    }
1437- 	efree (response );
14381437}
14391438
14401439/* Response for DEBUG object which is a formatted single line reply */ 
@@ -1852,7 +1851,8 @@ redis_mbulk_reply_loop(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
18521851    while (count  >  0 ) {
18531852        line  =  redis_sock_read (redis_sock , & len  TSRMLS_CC );
18541853        if  (line  !=  NULL ) {
1855-             zval  * z  =  NULL ;
1854+             zval  z , * z_p ;
1855+ 			z_p  =  & z ;
18561856            int  unwrap ;
18571857
18581858            /* We will attempt unserialization, if we're unserializing everything, 
@@ -1862,9 +1862,9 @@ redis_mbulk_reply_loop(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
18621862                (unserialize  ==  UNSERIALIZE_KEYS  &&  count  % 2  ==  0 ) || 
18631863                (unserialize  ==  UNSERIALIZE_VALS  &&  count  % 2  !=  0 );
18641864
1865-             if  (unwrap  &&  redis_unserialize (redis_sock , line , len , & z  TSRMLS_CC )) {
1865+             if  (unwrap  &&  redis_unserialize (redis_sock , line , len , & z_p  TSRMLS_CC )) {
18661866                efree (line );
1867-                 add_next_index_zval (z_tab , z );
1867+                 add_next_index_zval (z_tab , z_p );
18681868            } else  {
18691869                add_next_index_stringl (z_tab , line , len );
18701870            }
@@ -1885,7 +1885,7 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc
18851885    int  i , numElems ;
18861886    zval  z_multi_result ;
18871887
1888-     zval  * * z_keys  =  ctx ;
1888+     zval  * z_keys  =  ctx ;
18891889
18901890    if (-1  ==  redis_check_eof (redis_sock , 0  TSRMLS_CC )) {
18911891        return  -1 ;
@@ -1914,19 +1914,19 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc
19141914    for (i  =  0 ; i  <  numElems ; ++ i ) {
19151915        response  =  redis_sock_read (redis_sock , & response_len  TSRMLS_CC );
19161916        if (response  !=  NULL ) {
1917-             zval  * z  =  NULL ;
1918-             if (redis_unserialize (redis_sock , response , response_len , & z  TSRMLS_CC ) ==  1 ) {
1917+             zval  z , * z_p ;
1918+ 			z_p  =  & z ;
1919+             if (redis_unserialize (redis_sock , response , response_len , & z_p ) ==  1 ) {
19191920                efree (response );
1920-                 add_assoc_zval_ex (& z_multi_result , Z_STRVAL_P (z_keys [i ]), 1 + Z_STRLEN_P (z_keys [i ]), z );
1921+                 add_assoc_zval_ex (& z_multi_result , Z_STRVAL (z_keys [i ]), Z_STRLEN (z_keys [i ]), z_p );
19211922            } else  {
1922-                 add_assoc_stringl_ex (& z_multi_result , Z_STRVAL_P (z_keys [i ]), 1 + Z_STRLEN_P (z_keys [i ]), response , response_len );
1923+                 add_assoc_stringl_ex (& z_multi_result , Z_STRVAL (z_keys [i ]), Z_STRLEN (z_keys [i ]), response , response_len );
19231924            }
19241925        } else  {
1925-             add_assoc_bool_ex (& z_multi_result , Z_STRVAL_P (z_keys [i ]), 1 + Z_STRLEN_P (z_keys [i ]), 0 );
1926+             add_assoc_bool_ex (& z_multi_result , Z_STRVAL (z_keys [i ]), Z_STRLEN (z_keys [i ]), 0 );
19261927        }
1927-     zval_dtor (z_keys [i ]);
1928-     efree (z_keys [i ]);
1929-     }
1928+ 		zval_dtor (& z_keys [i ]);
1929+ 	}
19301930    efree (z_keys );
19311931
19321932    IF_MULTI_OR_PIPELINE () {
@@ -2018,7 +2018,7 @@ redis_serialize(RedisSock *redis_sock, zval *z, char **val, int *val_len
20182018            convert_to_string (& z_copy );
20192019            * val  =  Z_STRVAL_P (& z_copy );
20202020            * val_len  =  Z_STRLEN_P (& z_copy );
2021-             return  1 ;
2021+             return  0 ;
20222022
20232023        case  REDIS_SERIALIZER_PHP :
20242024
@@ -2028,14 +2028,14 @@ redis_serialize(RedisSock *redis_sock, zval *z, char **val, int *val_len
20282028            * val_len  =  sstr .s -> len ;
20292029            PHP_VAR_SERIALIZE_DESTROY (ht );
20302030
2031-             return  1 ;
2031+             return  0 ;
20322032
20332033        case  REDIS_SERIALIZER_IGBINARY :
20342034#ifdef  HAVE_REDIS_IGBINARY 
20352035            if (igbinary_serialize (& val8 , (size_t  * )& sz , z  TSRMLS_CC ) ==  0 ) {
20362036                * val  =  (char * )val8 ;
20372037                * val_len  =  (int )sz ;
2038-                 return  1 ;
2038+                 return  0 ;
20392039            }
20402040#endif 
20412041            return  0 ;
@@ -2056,16 +2056,7 @@ redis_unserialize(RedisSock* redis_sock, const char *val, int val_len,
20562056            return  0 ;
20572057
20582058        case  REDIS_SERIALIZER_PHP :
2059-             if (!* return_value ) {
2060- 				// TODO Sean-Der, heap allocation 
2061-                 //MAKE_STD_ZVAL(*return_value); 
2062-                 rv_free  =  1 ;
2063-             }
2064- #if  ZEND_MODULE_API_NO  >= 20100000 
20652059            PHP_VAR_UNSERIALIZE_INIT (var_hash );
2066- #else 
2067-             memset (& var_hash , 0 , sizeof (var_hash ));
2068- #endif 
20692060            if (!php_var_unserialize (* return_value , (const  unsigned char  * * )& val ,
20702061                    (const  unsigned char  * )val  +  val_len , & var_hash  TSRMLS_CC )) {
20712062                if (rv_free == 1 ) efree (* return_value );
@@ -2356,7 +2347,6 @@ redis_read_variant_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
23562347		/* Set our return value */ 
23572348		ZVAL_DUP (return_value , z_ret_p );
23582349		zval_dtor (z_ret_p );
2359- 		efree (z_ret_p );
23602350	}
23612351
23622352	/* Success */ 
0 commit comments