Bug #69376 [NEW]: Wrong ref counting

From: Date: Sat, 04 Apr 2015 15:36:54 +0000
Subject: Bug #69376 [NEW]: Wrong ref counting
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191815@lists.php.net to get a copy of this message
From: nicolas dot grekas+php at gmail dot com Operating system: PHP version: master-Git-2015-04-04 (snap) Package: Scripting Engine problem Bug Type: Bug Bug description:Wrong ref counting 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 bug report at https://bugs.php.net/bug.php?id=69376&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69376&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69376&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69376&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69376&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69376&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69376&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69376&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69376&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69376&r=support Expected behavior: https://bugs.php.net/fix.php?id=69376&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69376&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69376&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69376&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69376&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69376&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69376&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69376&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69376&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69376&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69376&r=mysqlcfg

« previous php.bugs (#191815) next »