bug55157_variation.phpt 487 B

1234567891011121314151617181920
  1. --TEST--
  2. Bug #55157: ArrayIterator always skips the second element in the array when calling offsetUnset()
  3. --DESCRIPTION--
  4. One of the test cases from bug #55157. This is a workaround around the problem that has worked
  5. since PHP 5.0.4.
  6. --FILE--
  7. <?php
  8. $nums = range(0, 3);
  9. $numIt = new ArrayIterator($nums);
  10. for ($numIt->rewind(); $numIt->valid();) {
  11. echo "{$numIt->key()} => {$numIt->current()}\n";
  12. $numIt->offsetUnset($numIt->key());
  13. }
  14. ?>
  15. --EXPECT--
  16. 0 => 0
  17. 1 => 1
  18. 2 => 2
  19. 3 => 3