Skip to content

Commit

Permalink
Merge pull request #24 from simplesamlphp/tvdijen-patch-1
Browse files Browse the repository at this point in the history
Normalize elements by dropping their parent objects
  • Loading branch information
tvdijen authored Jul 25, 2024
2 parents c73f55f + 3dd7c1d commit d06e0c6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ public static function getChildrenOfClass(DOMElement $parent): array
&& $node->namespaceURI === static::getNamespaceURI()
&& $node->localName === static::getLocalName()
) {
// Normalize the DOMElement by importing it into a clean empty document
$newDoc = DOMDocumentFactory::create();
/** @var \DOMElement $node */
$node = $newDoc->appendChild($newDoc->importNode($node, true));

$ret[] = static::fromXML($node);
}
}
Expand Down

0 comments on commit d06e0c6

Please sign in to comment.