2012/3/25 Arno Kuhl <a...@dotcontent.net>:
> will not only give the wrong result, it will corrupt the array for *any* 
> further use of that array. I still think it’s a bug according to the 
> definition of foreach in the php manual. Maybe php needs to do an implicit 
> unset at the closing brace of the foreach where was an assign $value by 
> reference, to remove the reference to the last element (or whatever element 
> it was pointing to if there was a break) so that it doesn't corrupt the 
> array, because any assign to $value after the foreach loop is completed will 
> corrupt the array (confirmed by testing). The average user (like me) wouldn't 
> think twice about reusing $value after ending the foreach loop, not realising 
> that without an unset the array will be corrupted.

Hi, Arno

Requesting that will at least require a major-release (f.e. PHP 6.0)
... but I would rather request to add a notice or warning to the
documentation of references to remind stuff like that.
I think this is stuff more people will stumble over ...


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to