1--TEST--
2SimpleXML: invoking current() after the iterator has already been consumed
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8$xml =<<<EOF
9<?xml version='1.0'?>
10<root>
11<elem/>
12</root>
13EOF;
14
15$sxe = simplexml_load_string($xml);
16
17try {
18    $sxe->current();
19} catch (Error $exception) {
20    echo $exception->getMessage() . "\n";
21}
22
23for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
24    var_dump($sxe->key(), $sxe->current());
25}
26
27try {
28    $sxe->current();
29} catch (Error $exception) {
30    echo $exception->getMessage() . "\n";
31}
32
33?>
34--EXPECT--
35Iterator not initialized or already consumed
36string(4) "elem"
37object(SimpleXMLElement)#3 (0) {
38}
39Iterator not initialized or already consumed
40