Skip to content

Commit cb04226

Browse files
authored
Avoid making a redundant copy in php_filter_callback() (#18794)
`call_user_function` already makes a copy to the call frame for its arguments, there's no need to do this ourselves.
1 parent ceffa70 commit cb04226

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

ext/filter/callback_filter.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL)
2020
{
2121
zval retval;
22-
zval args[1];
2322
int status;
2423

2524
if (!option_array || !zend_is_callable(option_array, IS_CALLABLE_SUPPRESS_DEPRECATIONS, NULL)) {
@@ -29,8 +28,7 @@ void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL)
2928
return;
3029
}
3130

32-
ZVAL_COPY(&args[0], value);
33-
status = call_user_function(NULL, NULL, option_array, &retval, 1, args);
31+
status = call_user_function(NULL, NULL, option_array, &retval, 1, value);
3432

3533
if (status == SUCCESS && !Z_ISUNDEF(retval)) {
3634
zval_ptr_dtor(value);
@@ -39,6 +37,4 @@ void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL)
3937
zval_ptr_dtor(value);
4038
ZVAL_NULL(value);
4139
}
42-
43-
zval_ptr_dtor(&args[0]);
4440
}

0 commit comments

Comments
 (0)