Skip to content

Conversation

@hrach
Copy link
Contributor

@hrach hrach commented Sep 6, 2020

  • bug fix: yes
  • BC break: no, but...
  • doc PR: no

The inner iterator is one iteration ahead and therefore when CachingIterator asks for the next value (key), it uses a current() method on the inner iterator. But the iteration may have finished and calling iterator's current() and key() in invalid state may produce an exception or invalid data.

PHP'S internal ArrayIterator returns a null, but generally speaking the iterators should rather throw. When doing types properly, we can't even type such interface.

This PR asks first if the inner iterator is in a valid state.

@hrach
Copy link
Contributor Author

hrach commented Sep 6, 2020

Test failures seems unrelated.

@dg dg force-pushed the master branch 4 times, most recently from 63d6779 to 31553c2 Compare September 29, 2020 13:23
@hrach
Copy link
Contributor Author

hrach commented Sep 29, 2020

@dg what do you think?

@dg dg force-pushed the master branch 4 times, most recently from f6d1b05 to 2a1d768 Compare September 29, 2020 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants