On 12-03-23 02:04 PM, Arno Kuhl wrote:
I'm using php 5.3.5. What result do you get when you run this code?
I haven't checked any bug reports, I'll google to see where I would do that.
Your code gets round the problem, but I was specifically referring to the use
of foreach with its unexpected side-effects.
I know... but when I first started doing things like what you tried to
do, there were no references for foreach values and so I've just
naturally been in the habit of explicitly accessing the values in the
array by index. Apparently that will serve me well since my stuff won't
blow up with this bug ;)
There are a few different designs like look-ahead where it seemed the obvious
way to go. I know I've used this type of foreach coding in the past, and have
this nagging feeling there's a whole bunch of code just waiting to explode. I
always just assumed it worked because it's pretty simple. I'd previously been
caught out forgetting the assign by reference in the foreach loop that modified
the array but I always caught it long before it went live, but I never
considered having to also use assign by reference in subsequent foreach loops
because it so obviously wasn't necessary. Now I'm searching through my scripts
to see if there are any potential problems caused by this (already found one),
and wondering what else I've done where I no longer have access to the sources.
BTW I'm told on another forum this issue has been discussed multiple times on
this mailing list - did I miss it? Was there a resolution?
I must have missed it too... but then I've not been very active in the
past year or so :)
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php