diff --git a/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php b/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php index 8770897..843b605 100644 --- a/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php +++ b/lib/FSi/DoctrineExtensions/Mapping/Driver/AbstractXmlDriver.php @@ -88,8 +88,10 @@ private function validateFile(DOMDocument $dom): bool continue; } - foreach ($dom->getElementsByTagNameNS($xmlns->nodeValue, '*') as $elem) { - $elem->parentNode->removeChild($elem); + $domNodeList = $dom->getElementsByTagNameNS($xmlns->nodeValue, '*'); + for ($i = $domNodeList->length; --$i >= 0; ) { + $element = $domNodeList->item($i); + $element->parentNode->removeChild($element); } }