1--TEST--
2SPL: RecursiveIteratorIterator::beginIteration() is called by RecursiveIteratorIterator::rewind()
3--CREDITS--
4Matt Raines matt@raines.me.uk
5#testfest London 2009-05-09
6--FILE--
7<?php
8$sample_array = array(1, 2);
9$sub_iterator = new RecursiveArrayIterator($sample_array);
10
11$iterator = new RecursiveIteratorIterator($sub_iterator);
12foreach ($iterator as $element) {
13  var_dump($element);
14}
15
16class SkipsFirstElementRecursiveIteratorIterator extends RecursiveIteratorIterator {
17  public function beginIteration() {
18    echo "::beginIteration() was invoked\n";
19    $this->next();
20  }
21}
22$iterator = new SkipsFirstElementRecursiveIteratorIterator($sub_iterator);
23foreach ($iterator as $element) {
24  var_dump($element);
25}
26?>
27--EXPECT--
28int(1)
29int(2)
30::beginIteration() was invoked
31int(2)
32
33