]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #33282 (Re-assignment by reference does not clear the is_ref
authorIlia Alshanetsky <iliaa@php.net>
Tue, 7 Nov 2006 20:28:40 +0000 (20:28 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 7 Nov 2006 20:28:40 +0000 (20:28 +0000)
flag)

Zend/tests/bug33282.phpt [new file with mode: 0644]
Zend/zend_execute.c

diff --git a/Zend/tests/bug33282.phpt b/Zend/tests/bug33282.phpt
new file mode 100644 (file)
index 0000000..65e3c16
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Bug #33282 (Re-assignment by reference does not clear the is_ref flag)
+--FILE--
+<?php
+       $a = array(1, 2, 3);
+       $r = &$a[0];
+       $r = &$a[1];
+       $r = &$a[2];
+       var_dump($a);
+?>
+--EXPECT--     
+array(3) {
+  [0]=>
+  int(1)
+  [1]=>
+  int(2)
+  [2]=>
+  &int(3)
+}
index ce8376580940d816c92489e0a602a15f51c8ff31..0b3a23e8fb57f92fcd79ff993114a16db933496a 100644 (file)
@@ -434,11 +434,7 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
                *variable_ptr_ptr = value_ptr;
                value_ptr->refcount++;
 
-               variable_ptr->refcount--;
-               if (variable_ptr->refcount==0) {
-                       zendi_zval_dtor(*variable_ptr);
-                       FREE_ZVAL(variable_ptr);
-               }
+               zval_ptr_dtor(&variable_ptr);
        } else if (!variable_ptr->is_ref) {
                if (variable_ptr_ptr == value_ptr_ptr) {
                        SEPARATE_ZVAL(variable_ptr_ptr);