PHP 4.0 Bug #2589 Updated: reference inconsistency

From: Date: Sat, 23 Oct 1999 20:00:48 +0000
Subject: PHP 4.0 Bug #2589 Updated: reference inconsistency
Groups: php.dev 
Request: Send a blank email to php-dev+get-11848@lists.php.net to get a copy of this message
ID: 2589 Updated by: andi Reported By: hholzgra@media-engineering.de Status: Closed Bug Type: Scripting Engine problem Assigned To: Comments: OK this is a tough one. The expression $ref = &$var changes the label "ref" to point to the value of $var. In your example, ref2 in the beginning of the function call is a reference to $y. After the command, $ref2 = &$top, the label "ref2" is changed to point at $top. The $ref = &$var construct doesn't change values, it just makes the lvalue variable point at another variable. As in the beginning of the function $ref1 and $x point at the same value, when you assign to $ref1, $x also changes. However, after $ref2 is reassigned to point at $top it no longer points at the previous value it pointed to $top. I hope you understand the explanation of why this isn't a bug. It's a bit complicated and I'm not too good at explaining such things :) Full Bug description available at: http://bugs.php.net/version4/?id=2589

« previous php.dev (#11848) next »