summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-07-01 18:50:35 +0800
committerXinchen Hui <laruence@gmail.com>2016-07-01 18:50:35 +0800
commitd1dd474ff903c2b7f6839e0ccba3e08fd47a1649 (patch)
tree02cdf1a0845b6b514aea3335367f66d400f3df36 /Zend
parentacdafc0a270107dd6bd8b930fd3c23de398fb8b4 (diff)
downloadphp-git-d1dd474ff903c2b7f6839e0ccba3e08fd47a1649.tar.gz
Fixed bug #72523 (dtrace issue with reflection (failed test))
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/generators/bug72523.phpt15
-rw-r--r--Zend/zend_vm_def.h4
-rw-r--r--Zend/zend_vm_execute.h4
3 files changed, 21 insertions, 2 deletions
diff --git a/Zend/tests/generators/bug72523.phpt b/Zend/tests/generators/bug72523.phpt
new file mode 100644
index 0000000000..74dc583974
--- /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 e9083e79f4..927b372d48 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 8132b64a34..f2ae082f91 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);
}