bug71154.phpt 409 B

12345678910111213141516171819
  1. --TEST--
  2. Bug #71154: Incorrect HT iterator invalidation causes iterator reuse
  3. --FILE--
  4. <?php
  5. $array = [1, 2, 3];
  6. foreach ($array as &$ref) {
  7. /* Free array, causing free of iterator */
  8. $array = [];
  9. /* Reuse the iterator.
  10. * However it will also be reused on next foreach iteration */
  11. $it = new ArrayIterator([1, 2, 3]);
  12. $it->rewind();
  13. }
  14. var_dump($it->current());
  15. ?>
  16. --EXPECT--
  17. int(1)