Re: [PHP-DEV] Re: Reference handling change and PHP 4.4.0

2005-09-16 Thread Todd Ruth
Wasn't part of the "negotiation" when 4.4 was created that the behavior would be the same as 4.3 (excluding anything that happened because of a memory corruption)? (I'm not counting the notices as behavior.) I don't see how it can be argued that "$y =& ..." leaving $y connected to it's old buddie

Re: [PHP-DEV] Re: Reference handling change and PHP 4.4.0

2005-09-16 Thread Derick Rethans
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: > > function f(&$a) { return $a; } > $x = array('a','b','c'); > foreach (array_keys($x) as $k) { >// I th

Re: [PHP-DEV] Re: Reference handling change and PHP 4.4.0

2005-09-15 Thread Todd Ruth
I should have said something about a fix. I guess the fix would be to always unset any variable that is attempting to be assigned by reference before doing anything else with the variable. Yes? That would at least fix BC for the example I gave (and I think Colin's example). If $y were unset (bas

Re: [PHP-DEV] Re: Reference handling change and PHP 4.4.0

2005-09-15 Thread Todd Ruth
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: 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[].