com php-src: Fixed bug #72523 (dtrace issue with reflection (failed test)): NEWS Zend/tests/generators/bug72523.phpt Zend/zend_vm_def .h
Zend/zend_vm_execute.h
| From: | Xinchen Hui | Date: | Fri, 01 Jul 2016 10:50:35 +0000 |
| Subject: | com php-src: Fixed bug #72523 (dtrace issue with reflection (failed test)): NEWS Zend/tests/generators/bug72523.phpt Zend/zend_vm_def .h Zend/zend_vm_execute.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92726@lists.php.net to get a copy of this message | ||
Commit: d1dd474ff903c2b7f6839e0ccba3e08fd47a1649
Author: Xinchen Hui <laruence@gmail.com> Fri, 1 Jul 2016 18:50:35 +0800
Parents: acdafc0a270107dd6bd8b930fd3c23de398fb8b4
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d1dd474ff903c2b7f6839e0ccba3e08fd47a1649
Log:
Fixed bug #72523 (dtrace issue with reflection (failed test))
Bugs:
https://bugs.php.net/72523
Changed paths:
M NEWS
A Zend/tests/generators/bug72523.phpt
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/NEWS b/NEWS
index f707f10..0eba2f5 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP NEWS
?? ??? 2016, PHP 7.1.0beta1
- Core:
+ . Fixed bug #72523 (dtrace issue with reflection (failed test)). (Laruence)
. Fixed bug #72508 (strange references after recursive function call and
"switch" statement). (Laruence)
diff --git a/Zend/tests/generators/bug72523.phpt b/Zend/tests/generators/bug72523.phpt
new file mode 100644
index 0000000..74dc583
--- /dev/null
+++ b/Zend/tests/generators/bug72523.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #72523 (dtrace issue with reflection (failed test))
+--FILE--
+<?php
+
+$gen = (new class() {
+ function a() {
+ yield "okey";
+ }
+})->a();
+
+var_dump($gen->current());
+?>
+--EXPECT--
+string(4) "okey"
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index e9083e7..927b372 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -4046,7 +4046,9 @@ ZEND_VM_HANDLER(41, ZEND_GENERATOR_CREATE, ANY, ANY)
gen_execute_data->return_value = (zval*)generator;
call_info = Z_TYPE_INFO(EX(This));
if ((call_info & Z_TYPE_MASK) == IS_OBJECT
- && !(call_info & ((ZEND_CALL_CLOSURE|ZEND_CALL_RELEASE_THIS) <<
ZEND_CALL_INFO_SHIFT))) {
+ && (!(call_info & ((ZEND_CALL_CLOSURE|ZEND_CALL_RELEASE_THIS) <<
ZEND_CALL_INFO_SHIFT))
+ /* Bug #72523 */
+ || UNEXPECTED(zend_execute_ex != execute_ex))) {
ZEND_ADD_CALL_FLAG_EX(call_info, ZEND_CALL_RELEASE_THIS);
Z_ADDREF(gen_execute_data->This);
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 8132b64..f2ae082 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1205,7 +1205,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
ZEND_GENERATOR_CREATE_SPEC_HANDLER(
gen_execute_data->return_value = (zval*)generator;
call_info = Z_TYPE_INFO(EX(This));
if ((call_info & Z_TYPE_MASK) == IS_OBJECT
- && !(call_info & ((ZEND_CALL_CLOSURE|ZEND_CALL_RELEASE_THIS) <<
ZEND_CALL_INFO_SHIFT))) {
+ && (!(call_info & ((ZEND_CALL_CLOSURE|ZEND_CALL_RELEASE_THIS) <<
ZEND_CALL_INFO_SHIFT))
+ /* Bug #72523 */
+ || UNEXPECTED(zend_execute_ex != execute_ex))) {
ZEND_ADD_CALL_FLAG_EX(call_info, ZEND_CALL_RELEASE_THIS);
Z_ADDREF(gen_execute_data->This);
}