At 21:22 13/09/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.
Worth thinking about, but if it's possible it's going to be very
messy. But still worth thinking about.
Zeev
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php