TysonAndre / pecl-teds

Tentative Extra Data Structures for php
BSD 3-Clause "New" or "Revised" License
30 stars 4 forks source link

InternalIterator->next() implicitly calls rewind - explicitly initialize and mark as rewound instead #184

Open TysonAndre opened 2 years ago

TysonAndre commented 2 years ago

zend_internal_iterator_ensure_rewound is static and so is the definition of zend_internal_iterator

This is counterproductive when ensuring predictable iteration behavior when getIterator does ensure the iterator is rewound

  1. Ensure iterator is initialized as if it were rewound
  2. Work on exposing an api to rewind these in php-src

Propose a new method zend_create_rewound_internal_iterator_zval for use in getIterator(): InternalIterator