ID: 33282 Updated by: [EMAIL PROTECTED] Reported By: devik at cdi dot cz -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: Linux -PHP Version: php5-STABLE-200506131036 +PHP Version: 5CVS-2005-06-13 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip And DO NOT invent your own style for the PHP version field!! (Hint: PHP version string does NOT contain 'PHP' in it..) Previous Comments: ------------------------------------------------------------------------ [2005-06-13 15:16:04] devik at cdi dot cz The same - still exhibits the behaviour. ------------------------------------------------------------------------ [2005-06-13 10:49:48] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip ------------------------------------------------------------------------ [2005-06-09 15:33:27] devik at cdi dot cz Description: ------------ This is variation on #15025. But I accept the bug is feature and I show other bug it triggers. Basic problem is that when you take ref of array item then the item will turn into reference (which will survive even array copy). I don't see it as too big problem as long as I can get rid of the reference. "unset" does the trick as expected: $r =& $A[0]; unset($r); - $A[0] is not reference any more But something like: $r =& $othervar; doesn't kill reference - you see zval with is_ref=1 and refcount=1. It prevents you from writing handy code: $c = &$c[$i] when traversing complex structures. Reproduce code: --------------- <? $a = array(1,2); $b =& $a[0]; echo "Now a[0] is reference, no problem\n"; debug_zval_dump($a); $b =& $a[1]; echo "Now a[0] has no reason to be reference any longer, but a[1] is\n"; debug_zval_dump($a); unset($b); echo "Now a[1] reference is gone too BUT WAIT, a[0] is still a ref !\n"; debug_zval_dump($a); ?> Expected result: ---------------- I expect $a without references. Actual result: -------------- $a[0] is reference with refcount(1). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33282&edit=1