Re: ref fix revisited

From: Date: Wed, 14 Sep 2005 12:48:09 +0000
Subject: Re: ref fix revisited
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-18882@lists.php.net to get a copy of this message
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)? Zeev

« previous php.internals (#18882) next »