Bug #69376 [Asn->Csd]: Wrong ref counting

From: Date: Mon, 06 Apr 2015 23:36:28 +0000
Subject: Bug #69376 [Asn->Csd]: Wrong ref counting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191864@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69376&edit=1 ID: 69376 Updated by: dmitry@php.net Reported by: nicolas dot grekas+php at gmail dot com Summary: Wrong ref counting -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: master-Git-2015-04-04 (snap) Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=55cdde3dd6c986e9e80d2f944ddfaab55c32a93a Log: Fixed bug #69376 (Wrong ref counting). Previous Comments: ------------------------------------------------------------------------ [2015-04-05 06:00:03] laruence@php.net we should deref if the refcount's refcount reach 1.. anyway, there are lot's of place need to check this... similar: $array = array(); $array[] = &$array; $a = $array; unset($array); $b = $a; $b[0] = 123; print_r($a); print_r($b); thanks ------------------------------------------------------------------------ [2015-04-04 15:36:54] nicolas dot grekas+php at gmail dot com Description: ------------ The test() function below triggers a bug in the ref counting of PHP7. The issue was fixed in 5.6 and early 7.0, but the most recent 7.0 break this again. See this in action at http://3v4l.org/0g0ID Test script: --------------- <?php function &test() { $var = array(); $var[] =& $var; return $var; }; $a = test(); $b = $a; $b[0] = 123; print_r($a); print_r($b); Expected result: ---------------- Array ( [0] => 123 ) Array ( [0] => 123 ) Actual result: -------------- Array ( [0] => Array *RECURSION* ) Array ( [0] => 123 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69376&edit=1

« previous php.bugs (#191864) next »