cvs: ZendEngine2 / zend_execute.c /tests bug34137.phpt php-src NEWS
| From: | Dmitry Stogov | Date: | Thu, 01 Sep 2005 13:21:04 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c /tests bug34137.phpt php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4091@lists.php.net to get a copy of this message | ||
dmitry Thu Sep 1 09:21:04 2005 EDT
Added files:
/ZendEngine2/tests bug34137.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_execute.c
Log:
Fixed bug #34137 (assigning array element by reference causes binary mess)
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2055&r2=1.2056&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2055 php-src/NEWS:1.2056
--- php-src/NEWS:1.2055 Thu Sep 1 08:00:25 2005
+++ php-src/NEWS Thu Sep 1 09:20:57 2005
@@ -22,5 +22,7 @@
(Derick)
- Fixed bug #34277 (array_filter() crashes with references and objects).
(Dmitry)
+- Fixed bug #34137 (assigning array element by reference causes binary mess).
+ (Dmitry)
- Fixed bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number).
(Derick)
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.717&r2=1.718&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.717 ZendEngine2/zend_execute.c:1.718
--- ZendEngine2/zend_execute.c:1.717 Thu Aug 11 19:34:56 2005
+++ ZendEngine2/zend_execute.c Thu Sep 1 09:20:59 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.717 2005/08/11 23:34:56 andrei Exp $ */
+/* $Id: zend_execute.c,v 1.718 2005/09/01 13:20:59 dmitry Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -415,12 +415,6 @@
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 @@
*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);
http://cvs.php.net/co.php/ZendEngine2/tests/bug34137.phpt?r=1.1&p=1
Index: ZendEngine2/tests/bug34137.phpt
+++ ZendEngine2/tests/bug34137.phpt
--TEST--
Bug #34137 (assigning array element by reference causes binary mess)
--FILE--
<?php
$arr1 = array('a1' => array('alfa' => 'ok'));
$arr1 =& $arr1['a1'];
echo '-'.$arr1['alfa']."-\n";
?>
--EXPECT--
-ok-