From: Dmitry Stogov Date: Thu, 23 Jun 2005 08:21:03 +0000 (+0000) Subject: Fixed bug #27268 (Bad references accentuated by clone). X-Git-Tag: php-5.1.0b3~342 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2037023874df83d47bdf96694a1615ae8281cef7;p=php Fixed bug #27268 (Bad references accentuated by clone). --- diff --git a/NEWS b/NEWS index 73891459ef..de255a8785 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2005, PHP 5.1 Beta 3 +- Fixed bug #27268 (Bad references accentuated by clone). (Dmitry) 22 Jun 2005, PHP 5.1 Beta 2 - Improved PHP extension loading mechanism with support for module dependencies diff --git a/Zend/tests/bug27268.phpt b/Zend/tests/bug27268.phpt new file mode 100755 index 0000000000..a86e8d0297 --- /dev/null +++ b/Zend/tests/bug27268.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #27268 (Bad references accentuated by clone) +--FILE-- +a; + } +} + +$A = new A; +$A->a = array(1); +$x = $A->getA(); +$clone = clone $A; +$clone->a = array(); +print_r($A); +?> +--EXPECT-- +A Object +( + [a] => Array + ( + [0] => 1 + ) + +) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 0aeee7f5bc..3a54926101 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -70,6 +70,9 @@ static inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free) /* should_free->is_var = 1; */ } else { should_free->var = 0; + if (z->is_ref && z->refcount == 1) { + z->is_ref = 0; + } } }