com php-src: FIxed bug #80299: NEWS Zend/zend_execute_API .c ext/reflection/tests/bug80299.phpt
| From: | Nikita Popov | Date: | Fri, 30 Oct 2020 16:23:18 +0000 |
| Subject: | com php-src: FIxed bug #80299: NEWS Zend/zend_execute_API .c ext/reflection/tests/bug80299.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-114000@lists.php.net to get a copy of this message | ||
Commit: 904c1b6589b999a8e387215ac3c8fce9e4ab62a8
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 30 Oct 2020 17:23:18 +0100
Parents: 5958137dc512ca4c6c82576b6f045559e39791e1
Branches: PHP-8.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=904c1b6589b999a8e387215ac3c8fce9e4ab62a8
Log:
FIxed bug #80299
The must_wrap was leaking across iterations.
Bugs:
https://bugs.php.net/80299
Changed paths:
M NEWS
M Zend/zend_execute_API.c
A ext/reflection/tests/bug80299.phpt
Diff:
diff --git a/NEWS b/NEWS
index 0884c32f3fc..2f45f378c13 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ PHP NEWS
- Opcache:
. Fixed run-time binding of preloaded dynamically declared function. (Dmitry)
+- Reflection:
+ . Fixed bug #80299 (ReflectionFunction->invokeArgs confused in arguments).
+ (Nikita)
+
- Standard:
. Don't force rebuild of symbol table, when populating $http_response_header
variable by the HTTP stream wrapper.. (Dmitry)
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 7572a0d8900..42482122389 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 00000000000..61aec5b1ce0
--- /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