This sort of thing needs to throw an error in any version of PHP I think:
function foo() { return "blah"; }
function bar(&$arg) { $arg = 1; }
bar(foo());
While this should work:
function & foo() { static $a; return $a; }
function bar(&$arg) { $arg = 1; }
bar(foo());
And it does in PHP5.1 at least. The first case indicates a clear bug in the code that we really should be catching. I suppose we could compromise and throw a warning in PHP4 and then fall back to passing the argument by value, but that is changing the actual workings of the script and is likely going to be wrong. I think this needs to be part of the reference fixes in PHP4.4. Sucks that it wasn't caught before the 4.4.0 release, but that's the way it goes.