Skip to content

Commit 904c1b6

Browse files
committed
FIxed bug #80299
The must_wrap was leaking across iterations.
1 parent 5958137 commit 904c1b6

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ PHP NEWS
1212
- Opcache:
1313
. Fixed run-time binding of preloaded dynamically declared function. (Dmitry)
1414

15+
- Reflection:
16+
. Fixed bug #80299 (ReflectionFunction->invokeArgs confused in arguments).
17+
(Nikita)
18+
1519
- Standard:
1620
. Don't force rebuild of symbol table, when populating $http_response_header
1721
variable by the HTTP stream wrapper. (Dmitry)

Zend/zend_execute_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
807807
zval *arg;
808808
uint32_t arg_num = ZEND_CALL_NUM_ARGS(call) + 1;
809809
zend_bool have_named_params = 0;
810-
zend_bool must_wrap = 0;
811810
ZEND_HASH_FOREACH_STR_KEY_VAL(fci->named_params, name, arg) {
811+
zend_bool must_wrap = 0;
812812
zval *target;
813813
if (name) {
814814
void *cache_slot[2] = {NULL, NULL};

ext/reflection/tests/bug80299.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #80299: ReflectionFunction->invokeArgs confused in arguments
3+
--FILE--
4+
<?php
5+
6+
$bar = new DateTime();
7+
$args = [1, &$bar];
8+
9+
$function = function (int &$foo, DateTimeInterface &$bar) {};
10+
11+
(new ReflectionFunction($function))->invokeArgs($args);
12+
13+
?>
14+
--EXPECTF--
15+
Warning: {closure}(): Argument #1 ($foo) must be passed by reference, value given in %s on line %d

0 commit comments

Comments
 (0)