File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -5622,15 +5622,18 @@ PHP_REDIS_API void generic_subscribe_cmd(INTERNAL_FUNCTION_PARAMETERS, char *sub
56225622 if (zend_hash_index_find (Z_ARRVAL_P (z_tab ), 0 , (void * * )& tmp ) == SUCCESS ) {
56235623 type_response = Z_STRVAL_PP (tmp );
56245624 if (strcmp (type_response , sub_cmd ) != 0 ) {
5625- efree (tmp );
5626- efree (z_tab );
5625+ efree (tmp );
5626+ zval_dtor (z_tab );
5627+ efree (z_tab );
56275628 RETURN_FALSE ;
56285629 }
56295630 } else {
5630- efree (z_tab );
5631+ zval_dtor (z_tab );
5632+ efree (z_tab );
56315633 RETURN_FALSE ;
56325634 }
5633- efree (z_tab );
5635+ zval_dtor (z_tab );
5636+ efree (z_tab );
56345637
56355638 /* Set a pointer to our return value and to our arguments. */
56365639 z_callback .retval_ptr_ptr = & z_ret ;
@@ -5698,10 +5701,19 @@ PHP_REDIS_API void generic_subscribe_cmd(INTERNAL_FUNCTION_PARAMETERS, char *sub
56985701 break ;
56995702 }
57005703
5701- /* If we have a return value, free it. Note, we could use the return value to break the subscribe loop */
5702- if (z_ret ) zval_ptr_dtor (& z_ret );
5704+ /* Free our return value if we have one. If the return value is a bool
5705+ * that is FALSE, break our subscribe loop and return control to the
5706+ * userland code */
5707+ if (z_ret ) {
5708+ if (Z_TYPE_P (z_ret ) == IS_BOOL && Z_BVAL_P (z_ret ) == 0 ) {
5709+ zval_ptr_dtor (& z_ret );
5710+ zval_dtor (z_tab );
5711+ efree (z_tab );
5712+ break ;
5713+ }
5714+ zval_ptr_dtor (& z_ret );
5715+ }
57035716
5704- /* TODO: provide a way to break out of the loop. */
57055717 zval_dtor (z_tab );
57065718 efree (z_tab );
57075719 }
You can’t perform that action at this time.
0 commit comments