Re: ref fix revisited

From: Date: Tue, 13 Sep 2005 18:22:50 +0000
Subject: Re: ref fix revisited
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-18842@lists.php.net to get a copy of this message
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. -Rasmus

« previous php.internals (#18842) next »