Skip to content

Commit

Permalink
Reflection: Copy invoke function also in the variadic case
Browse files Browse the repository at this point in the history
It doesn't matter how the parameters are provided, we always have
to copy the trampoline invoke function.
  • Loading branch information
nikic committed Oct 3, 2018
1 parent db80e0e commit 945f315
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ext/reflection/php_reflection.c
Expand Up @@ -3332,13 +3332,11 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
fcc.called_scope = intern->ce;
fcc.object = object ? Z_OBJ_P(object) : NULL;

if (!variadic) {
/*
* Copy the zend_function when calling via handler (e.g. Closure::__invoke())
*/
if ((mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
fcc.function_handler = _copy_function(mptr);
}
/*
* Copy the zend_function when calling via handler (e.g. Closure::__invoke())
*/
if ((mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
fcc.function_handler = _copy_function(mptr);
}

result = zend_call_function(&fci, &fcc);
Expand Down

0 comments on commit 945f315

Please sign in to comment.