Re: ref fix revisited

From: Date: Wed, 14 Sep 2005 12:58:18 +0000
Subject: Re: ref fix revisited
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-18886@lists.php.net to get a copy of this message
At 15:54 14/09/2005, Edin Kadribasic wrote:
Zeev Suraski wrote: At 15:36 14/09/2005, Derick Rethans wrote:
On Tue, 13 Sep 2005, Rasmus Lerdorf wrote:
Zeev Suraski wrote:
But there are many other cases where a function legitimately takes a by-ref and doesn't necessarily write to it or the write is a secondary action not required for
the code
to work. Could we not catch this on the write instead of on the
call? The problem is that there's no way to tell that element apart at that time. It's too late. As soon as we treat a read-only zval as if it's read/write (take a ** instead of a *), it's too late, since we can't really detect later on where it came from.
Since we can detect a ref to a temp var at call time now, how about making a local copy in the function and effectively treat it as a by-value arg and also issue an E_NOTICE or an E_STRICT? I think that would solve the corruption problem without breaking BC.
That's exactly what we do in 4.4.
Except it is reported to break BC still.. (beyond the notices)? The biggest BC break occured in 5.0.4->5.0.5 where some of these referrence issues cause a fatal error, not a mere notice.
I think it's probably equally big, but it's besides the point. I'm trying to understand what we can do (in 5.0.6 or whatever) that will really solve the problem. The 4.4 approach at this point doesn't appear to be any better since regardless of error messages, it makes PHP behave differently than it did before. Zeev

« previous php.internals (#18886) next »