]> granicus.if.org Git - php/commitdiff
MTH: Fixed foreach by-ref bug
authorDmitry Stogov <dmitry@php.net>
Mon, 18 Jun 2007 11:20:01 +0000 (11:20 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 18 Jun 2007 11:20:01 +0000 (11:20 +0000)
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 0917ef655b241d16541beddffb919ab629fbebff..05b307a9f05ec0062a16554d34210122001a0710 100644 (file)
@@ -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++;
index 3004be7a5bad458d06bcf7e00daf8ac191860b35..704f2efb3a2fc7aee88d7189c85daadeb83610f0 100644 (file)
@@ -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++;