From: Operating system: ubuntu linux 10.10 PHP version: 5.3.5 Package: Variables related Bug Type: Bug Bug description:GC process circle references
Description: ------------ If I first assigned value by value, the result is correct. But if I first assigned value by references, result is very strange. <?php $array2 = array('ooo'); $array2[] =& $array2; $array2[] = $array2; xdebug_debug_zval(array2); ?> Above script will get bellow output: array2: (refcount=3, is_ref=1)=array (0 => (refcount=2, is_ref=0)='ooo', 1 => (refcount=3, is_ref=1)=..., 2 => (refcount=2, is_ref=0)=array (0 => (refcount=2, is_ref=0)='ooo', 1 => (refcount=3, is_ref=1)=..., 2 => (refcount=2, is_ref=0)=...)) but when run at "$array2[] = $array2", $array2[2] now haven't any value, but after assigned, it have a circle reference to $array2[2]... I think this is a bug... If this is't a bug, could tell me why? Test script: --------------- <?php $array1 = array('ooo'); $array1[] = $array1; $array1[] =& $array1; $array2 = array('ooo'); $array2[] =& $array2; $array2[] = $array2; print "<h1>Initial datas</h1>"; print <<< 'nowdoc' $array1 = array('ooo');<br /> $array1[] = $array1;<br /> $array1[] =& $array1;<br /> $array2 = array('ooo');<br /> $array2[] =& $array2;<br /> $array2[] = $array2;<br /> nowdoc; print "<h1>xdebug_debug_zval result:</h1>"; xdebug_debug_zval("array1"); print "<br />"; xdebug_debug_zval("array2"); print "<br />"; ?> -- Edit bug report at http://bugs.php.net/bug.php?id=54116&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54116&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54116&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54116&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54116&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54116&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54116&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54116&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54116&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54116&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54116&r=support Expected behavior: http://bugs.php.net/fix.php?id=54116&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54116&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54116&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54116&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54116&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54116&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54116&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54116&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54116&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54116&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54116&r=mysqlcfg