Thank you everyone for your feedback. Nikita's post about wrapping the array with an ArrayIterator provides the best approach to allow an array or Traversable to be used. This will also provide the greatest backwards compatible usage for those of us writing user code that would need to be compatible with 5.6 and 7.x.
I think it would be bad to remove these functions and force users to wrap arrays with ArrayIterator, just to manually iterate an array. After spending a little time looking through how these functions are being used in frameworks and libraries, removing them seems like it will cause more harm than good, even in a future version of the language. Toward Andrea's suggestion of replacing the IAP in these functions, I'll take a look and see what I can come up with. Considering the current usage of these functions, I don't think this will generate a lot of overhead. Again, thanks for the feedback! Dave On 10/26/16 8:42 AM, David Lundgren wrote: > Greetings, > > As suggested by several reviewers of a PR[1] I recently submitted, I'd > like to get feedback on letting custom Iterators be used in the current, > next, reset, and key functions. If this is something to move forward > with, I'll need some help with the RFC process. > > Recent experiences trying to use these functions with a custom Iterator, > and a bug[2], led me to try and fix this. BC will occur when an object > implementing Iterator is passed to one of the functions, as the > interface methods will be called, instead of returning the objects > properties. The old behavior should be maintained for classes that do > not implement Iterator. > > [1] https://github.com/php/php-src/pull/2176 > [2] https://bugs.php.net/bug.php?id=49369 > > Thanks, > Dave > -- David Lundgren dlundg...@syberisle.net GPG: 0x26F54D7F -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php