diff options
author | Dmitry Stogov <dmitry@php.net> | 2005-09-01 13:21:04 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2005-09-01 13:21:04 +0000 |
commit | bd307bc0bd65d4dc4fe0853cc2ae6fbd12c0fe6c (patch) | |
tree | 9292e5c22fce53c09c32a10a8090e5df507abda4 /Zend/zend_execute.c | |
parent | 176a76dbec89c9ceb8a42cacacdaf0bc9983b892 (diff) | |
download | php-git-bd307bc0bd65d4dc4fe0853cc2ae6fbd12c0fe6c.tar.gz |
Fixed bug #34137 (assigning array element by reference causes binary mess)
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r-- | Zend/zend_execute.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 8aa30d3c86..efe34c8118 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -415,12 +415,6 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) { variable_ptr_ptr = &EG(uninitialized_zval_ptr); } else if (variable_ptr != value_ptr) { - variable_ptr->refcount--; - if (variable_ptr->refcount==0) { - zendi_zval_dtor(*variable_ptr); - FREE_ZVAL(variable_ptr); - } - if (!PZVAL_IS_REF(value_ptr)) { /* break it away */ value_ptr->refcount--; @@ -436,6 +430,12 @@ 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); + } } else if (!variable_ptr->is_ref) { if (variable_ptr_ptr == value_ptr_ptr) { SEPARATE_ZVAL(variable_ptr_ptr); |