Skip to content

Commit 83f6f85

Browse files
committed
Use zval_ptr_dtor() instead of legacy zval_dtor(), to destroy unused values returned from PHP functions (they may be circular data structures).
1 parent 273e194 commit 83f6f85

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

ext/interbase/php_ibase_udf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv)
334334
break;
335335
}
336336

337-
zval_dtor(&return_value);
337+
zval_ptr_dtor(&return_value);
338338

339339
return;
340340

ext/intl/uchar/uchar.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ static UBool enumCharType_callback(enumCharType_data *context,
205205
if (zend_call_function(&context->fci, &context->fci_cache) == FAILURE) {
206206
intl_error_set_code(NULL, U_INTERNAL_PROGRAM_ERROR);
207207
intl_errors_set_custom_msg(NULL, "enumCharTypes callback failed", 0);
208-
zval_dtor(&retval);
208+
zval_ptr_dtor(&retval);
209209
return 0;
210210
}
211-
zval_dtor(&retval);
211+
zval_ptr_dtor(&retval);
212212
return 1;
213213
}
214214
IC_METHOD(enumCharTypes) {
@@ -319,11 +319,11 @@ static UBool enumCharNames_callback(enumCharNames_data *context,
319319
if (zend_call_function(&context->fci, &context->fci_cache) == FAILURE) {
320320
intl_error_set_code(NULL, U_INTERNAL_PROGRAM_ERROR);
321321
intl_error_set_custom_msg(NULL, "enumCharNames callback failed", 0);
322-
zval_dtor(&retval);
322+
zval_ptr_dtor(&retval);
323323
zval_ptr_dtor_str(&args[2]);
324324
return 0;
325325
}
326-
zval_dtor(&retval);
326+
zval_ptr_dtor(&retval);
327327
zval_ptr_dtor_str(&args[2]);
328328
return 1;
329329
}

ext/soap/soap.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ PHP_METHOD(SoapServer, handle)
15401540

15411541
zval_ptr_dtor(&param);
15421542
zval_ptr_dtor_str(&readfile);
1543-
zval_dtor(&readfile_ret);
1543+
zval_ptr_dtor(&readfile_ret);
15441544

15451545
SOAP_SERVER_END_CODE();
15461546
return;
@@ -1699,12 +1699,12 @@ PHP_METHOD(SoapServer, handle)
16991699
php_output_discard();
17001700
_soap_server_exception(service, function, getThis());
17011701
zval_ptr_dtor_str(&constructor);
1702-
zval_dtor(&c_ret);
1702+
zval_ptr_dtor(&c_ret);
17031703
zval_ptr_dtor(&tmp_soap);
17041704
goto fail;
17051705
}
17061706
zval_ptr_dtor_str(&constructor);
1707-
zval_dtor(&c_ret);
1707+
zval_ptr_dtor(&c_ret);
17081708
} else {
17091709
int class_name_len = ZSTR_LEN(service->soap_class.ce->name);
17101710
char *class_name = emalloc(class_name_len+1);
@@ -1722,14 +1722,14 @@ PHP_METHOD(SoapServer, handle)
17221722
php_output_discard();
17231723
_soap_server_exception(service, function, getThis());
17241724
zval_ptr_dtor_str(&constructor);
1725-
zval_dtor(&c_ret);
1725+
zval_ptr_dtor(&c_ret);
17261726
efree(class_name);
17271727
zval_ptr_dtor(&tmp_soap);
17281728
goto fail;
17291729
}
17301730

17311731
zval_ptr_dtor_str(&constructor);
1732-
zval_dtor(&c_ret);
1732+
zval_ptr_dtor(&c_ret);
17331733
}
17341734
efree(class_name);
17351735
}
@@ -1953,7 +1953,7 @@ PHP_METHOD(SoapServer, handle)
19531953
efree(h->parameters);
19541954
}
19551955
zval_ptr_dtor_str(&h->function_name);
1956-
zval_dtor(&h->retval);
1956+
zval_ptr_dtor(&h->retval);
19571957
efree(h);
19581958
}
19591959
service->soap_headers_ptr = NULL;
@@ -2683,7 +2683,7 @@ static void do_soap_call(zend_execute_data *execute_data,
26832683
encode_finish();
26842684
}
26852685

2686-
zval_dtor(&response);
2686+
zval_ptr_dtor(&response);
26872687

26882688
} else {
26892689
smart_str error = {0};
@@ -2728,7 +2728,7 @@ static void do_soap_call(zend_execute_data *execute_data,
27282728
encode_finish();
27292729
}
27302730

2731-
zval_dtor(&response);
2731+
zval_ptr_dtor(&response);
27322732
}
27332733
}
27342734

ext/standard/basic_functions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5054,7 +5054,7 @@ static int user_shutdown_function_call(zval *zv) /* {{{ */
50545054
shutdown_function_entry->arg_count - 1,
50555055
shutdown_function_entry->arguments + 1) == SUCCESS)
50565056
{
5057-
zval_dtor(&retval);
5057+
zval_ptr_dtor(&retval);
50585058
}
50595059
return 0;
50605060
}
@@ -5075,7 +5075,7 @@ static void user_tick_function_call(user_tick_function_entry *tick_fe) /* {{{ */
50755075
tick_fe->arg_count - 1,
50765076
tick_fe->arguments + 1
50775077
) == SUCCESS) {
5078-
zval_dtor(&retval);
5078+
zval_ptr_dtor(&retval);
50795079

50805080
} else {
50815081
zval *obj, *method;

0 commit comments

Comments
 (0)