On Thu, 15 Sep 2005, Todd Ruth wrote: > Aha! That was the inspiration I needed to get the right > combination of "&"s. The following bit of code behaves > differently under 4.3 vs 4.4: > > <?php > function f(&$a) { return $a; } > $x = array('a','b','c'); > foreach (array_keys($x) as $k) { > // I think the following line disconnects $y in 4.3 > // but leaves $y connected in 4.4 > $y =& f($x[$k]); > $z[] =& $y; > } > var_dump($x); > var_dump($z); > ?> > > My guess would be that in 4.3 the engine tries to do the > reference even though it may be dangerous. That would > "disconnect" $y from the previous $z[]. 4.4 knows the > reference is impossible and leaves $y connected to the > previous $z[]. Is that analysis correct, engine gurus?
Yes, it is. This has bitten me too a couple of times. But ofcourse, the new behavior *is* the correct one. Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php