From: Dmitry Stogov Date: Mon, 18 Jun 2007 11:20:01 +0000 (+0000) Subject: MTH: Fixed foreach by-ref bug X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~428 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0b6ee9d3b467c0069171778adf017e17d574152;p=php MTH: Fixed foreach by-ref bug --- diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 0917ef655b..05b307a9f0 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3221,6 +3221,9 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); + if (opline->extended_value & ZEND_FE_FETCH_BYREF) { + (*array_ptr_ptr)->is_ref = 1; + } } array_ptr = *array_ptr_ptr; array_ptr->refcount++; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 3004be7a5b..704f2efb3a 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2150,6 +2150,9 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); + if (opline->extended_value & ZEND_FE_FETCH_BYREF) { + (*array_ptr_ptr)->is_ref = 1; + } } array_ptr = *array_ptr_ptr; array_ptr->refcount++; @@ -4829,6 +4832,9 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); + if (opline->extended_value & ZEND_FE_FETCH_BYREF) { + (*array_ptr_ptr)->is_ref = 1; + } } array_ptr = *array_ptr_ptr; array_ptr->refcount++; @@ -8096,6 +8102,9 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); + if (opline->extended_value & ZEND_FE_FETCH_BYREF) { + (*array_ptr_ptr)->is_ref = 1; + } } array_ptr = *array_ptr_ptr; array_ptr->refcount++; @@ -20742,6 +20751,9 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); + if (opline->extended_value & ZEND_FE_FETCH_BYREF) { + (*array_ptr_ptr)->is_ref = 1; + } } array_ptr = *array_ptr_ptr; array_ptr->refcount++;