Revision Date Author Comments
# d4d0852c 23-Apr-2020 Alex Dowad

SplDoublyLinkedList uses iteration flags in iterator struct

The 'flags' field in spl_dllist_it was formerly unused. This means that if one started to
iterate over an SplDoublyLinkedList

SplDoublyLinkedList uses iteration flags in iterator struct

The 'flags' field in spl_dllist_it was formerly unused. This means that if one started to
iterate over an SplDoublyLinkedList using 'foreach', and then *changed* the iteration mode
halfway, the 'foreach' loop would start iterating in the opposite direction. Probably this
was not what was intended.

Therefore, use the 'flags' field in spl_dllist_it for iteration via 'foreach'. For explicit
iteration using methods like '::next()' and '::current()', continue to use the flags in
the SplDoublyLinkedList object itself.

show more ...