Skip to content

Commit

Permalink
Fixed bug #72523 (dtrace issue with reflection (failed test))
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Jul 1, 2016
1 parent acdafc0 commit d1dd474
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
15 changes: 15 additions & 0 deletions Zend/tests/generators/bug72523.phpt
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 3 additions & 1 deletion Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion Zend/zend_vm_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit d1dd474

Please sign in to comment.