From: Xinchen Hui Date: Fri, 1 Jul 2016 10:50:35 +0000 (+0800) Subject: Fixed bug #72523 (dtrace issue with reflection (failed test)) X-Git-Tag: php-7.1.0alpha3~47 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1dd474ff903c2b7f6839e0ccba3e08fd47a1649;p=php Fixed bug #72523 (dtrace issue with reflection (failed test)) --- diff --git a/NEWS b/NEWS index f707f10a9b..0eba2f5fca 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 0000000000..74dc583974 --- /dev/null +++ b/Zend/tests/generators/bug72523.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #72523 (dtrace issue with reflection (failed test)) +--FILE-- +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); }