diff options
-rw-r--r-- | Zend/zend_execute_API.c | 2 | ||||
-rw-r--r-- | ext/reflection/tests/bug80299.phpt | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 2eb3463eff..8fb85f0d2f 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -807,8 +807,8 @@ cleanup_args: zval *arg; uint32_t arg_num = ZEND_CALL_NUM_ARGS(call) + 1; zend_bool have_named_params = 0; - zend_bool must_wrap = 0; ZEND_HASH_FOREACH_STR_KEY_VAL(fci->named_params, name, arg) { + zend_bool must_wrap = 0; zval *target; if (name) { void *cache_slot[2] = {NULL, NULL}; diff --git a/ext/reflection/tests/bug80299.phpt b/ext/reflection/tests/bug80299.phpt new file mode 100644 index 0000000000..61aec5b1ce --- /dev/null +++ b/ext/reflection/tests/bug80299.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #80299: ReflectionFunction->invokeArgs confused in arguments +--FILE-- +<?php + +$bar = new DateTime(); +$args = [1, &$bar]; + +$function = function (int &$foo, DateTimeInterface &$bar) {}; + +(new ReflectionFunction($function))->invokeArgs($args); + +?> +--EXPECTF-- +Warning: {closure}(): Argument #1 ($foo) must be passed by reference, value given in %s on line %d |