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

From: Date: Sun, 05 Apr 2015 06:00:28 +0000
Subject: Bug #69376 [Ana->Asn]: Wrong ref counting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191830@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: laruence@php.net Reported by: nicolas dot grekas+php at gmail dot com Summary: Wrong ref counting -Status: Analyzed +Status: Assigned Type: Bug Package: Scripting Engine problem PHP Version: master-Git-2015-04-04 (snap) Assigned To: dmitry Block user comment: N Private report: N 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 (#191830) next »