### Description The following code: ```php <?php $xml = "<root><a/><a/></root>"; $xml = simplexml_load_string($xml); $a = $xml->a; foreach ($a as $test) { var_dump($a->key()); var_dump($a->getName()); } ``` Resulted in this output: an infinite loop But I expected this output instead: ``` string(1) "a" string(1) "a" ``` This happens because getName() resets the iterator to the start. It should be fixed by restoring the iterator after fetching the name... ### PHP Version At least 8.1+, probably a very old bug ### Operating System Linux