Forum Moderators: coopster

Message Too Old, No Replies

Only variables can be passed by reference

bug in latest PHP release

         

dcrombie

12:53 pm on Sep 8, 2005 (gmt 0)



Followup from: [webmasterworld.com...]

The bug mentioned in the above thread is also present in version 5.0.5 and affects a range of functions:

The following code will generate an error:

return end(explode(" ", $host));

The fix:

$tmp = explode(" ", $host); 
return end($tmp);


This will also error:

$category = array_shift(array_keys($categories));

The fix:

$tmp = array_keys($categories); 
$category = array_shift($tmp);


And this:

list($parent, $num) = each(end($this->tags));

These are actual examples that needed to be patched on our system - I think you can see the pattern ;)

coopster

10:40 pm on Sep 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Anybody else confirm this yet? I don't have 5.0.5 updated on any of my boxes yet. I suppose I could build one this weekend and see if I can replicate. That's if I get around to it this weekend ;)