From: Nikita Popov Date: Tue, 14 Apr 2015 14:35:23 +0000 (+0200) Subject: Fixed bug #69419 X-Git-Tag: php-5.5.25RC1~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95650d0942c99db8c247797d2ce708a586298ae9;p=php Fixed bug #69419 --- diff --git a/NEWS b/NEWS index 800393842d..a71c3fca5b 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ PHP NEWS . Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer). (Dmitry) . Fixed bug #68652 (segmentation fault in destructor). (Dmitry) + . Fixed bug #69419 (Returning compatible sub generator produces a warning). + (Nikita) - cURL: . Fixed bug #68739 (Missing break / control flow). (Laruence) diff --git a/Zend/tests/generators/bug69419.phpt b/Zend/tests/generators/bug69419.phpt new file mode 100644 index 0000000000..dce08edb7e --- /dev/null +++ b/Zend/tests/generators/bug69419.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #69419: Returning compatible sub generator produces a warning +--FILE-- + +--EXPECTF-- +Notice: Only variable references should be returned by reference in %s on line %d +int(1) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 66758d47fa..9e68290a9e 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1996,13 +1996,12 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) EX_T(opline->result.var).var.ptr = NULL; } } else if (fbc->type == ZEND_USER_FUNCTION) { + temp_variable *ret = &EX_T(opline->result.var); EX(original_return_value) = EG(return_value_ptr_ptr); EG(active_symbol_table) = NULL; EG(active_op_array) = &fbc->op_array; EG(return_value_ptr_ptr) = NULL; if (RETURN_VALUE_USED(opline)) { - temp_variable *ret = &EX_T(opline->result.var); - ret->var.ptr = NULL; EG(return_value_ptr_ptr) = &ret->var.ptr; ret->var.ptr_ptr = &ret->var.ptr; @@ -2011,7 +2010,8 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) { if (RETURN_VALUE_USED(opline)) { - EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC); + ret->var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC); + ret->var.fcall_returned_reference = 0; } } else if (EXPECTED(zend_execute_ex == execute_ex)) { if (EXPECTED(EG(exception) == NULL)) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 58ca552b82..706d00b1b4 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -559,13 +559,12 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR EX_T(opline->result.var).var.ptr = NULL; } } else if (fbc->type == ZEND_USER_FUNCTION) { + temp_variable *ret = &EX_T(opline->result.var); EX(original_return_value) = EG(return_value_ptr_ptr); EG(active_symbol_table) = NULL; EG(active_op_array) = &fbc->op_array; EG(return_value_ptr_ptr) = NULL; if (RETURN_VALUE_USED(opline)) { - temp_variable *ret = &EX_T(opline->result.var); - ret->var.ptr = NULL; EG(return_value_ptr_ptr) = &ret->var.ptr; ret->var.ptr_ptr = &ret->var.ptr; @@ -574,7 +573,8 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) { if (RETURN_VALUE_USED(opline)) { - EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC); + ret->var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC); + ret->var.fcall_returned_reference = 0; } } else if (EXPECTED(zend_execute_ex == execute_ex)) { if (EXPECTED(EG(exception) == NULL)) {