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.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to