Hi Rasmus, thanks for replying, I appreciate your feedback.

Rasmus Lerdorf wrote:
We have been looking to see if there is a way to fix the memory
corruption issue in a way that has less of an impact on existing code.
This doesn't change the fact that every error you get is actually an
error in the code you are running.

Yes, I know this now, but I guess at the time it seemed ok, because it wasn't an error then. :)

Right now the change in 4.4 and 5.x is to complain loudly when you pass
a reference to something without any associated storage.  In both of the
above examples there is no permanent storage associated with either of
the passed arguments, so trying to get a reference to this storage makes
very little sense.  The only feasible way we might be able to work
around this is to make a copy of such bogus reference attempts and
effectively just pretend they were passed by value.  I think it is a bit
of a hack, but at the same time the breakage of existing apps has been
more widespread than I think anybody anticipated.  I'd still want to
throw a notice to let people know they are doing something odd though.

Well for one I'm glad that PHP5 handles all objects as references now because this was primarily the reason I used references in PHP4, i.e. to ensure that copies of objects were not being passed around. Plus, I'm now in the process of converting my core code to PHP5 using it's 'proper OO' features. However, as you mentioned, this still leaves a lot of broken PHP4 code under 4.4 and above. I completely understand now why the change was made, I just guess a lot of us were doing funny things with references that we shouldn't have been. I suppose it's a tricky situation for you guys as there was no solution that wouldn't cause at least some breakage.

Cheers,

Colin.

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

Reply via email to