Skip to content

Commit 35b1ab9

Browse files
committed
Fix DOMXPath use
1 parent c9a2951 commit 35b1ab9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/XML/ds/XPath.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use DOMElement;
88
use SimpleSAML\XML\Exception\InvalidDOMElementException;
9+
use SimpleSAML\XMLSecurity\Utils\XPath as XPathUtils;
910
use Webmozart\Assert\Assert;
1011

1112
use function str_replace;
@@ -108,9 +109,9 @@ public static function fromXML(DOMElement $xml): object
108109
Assert::same($xml->namespaceURI, self::NS, InvalidDOMElementException::class);
109110

110111
$namespaces = [];
111-
$xpath = new \DOMXPath($xml->ownerDocument);
112+
$xpath = XPathUtils::getXPath($xml->ownerDocument);
112113
/** @var \DOMNode $ns */
113-
foreach ($xpath->query('./namespace::*', $xml) as $ns) {
114+
foreach (XPathUtils::xpQuery($xml, './namespace::*', $xpath) as $ns) {
114115
if ($xml->getAttributeNode($ns->nodeName)) {
115116
// only add namespaces when they are defined explicitly in an attribute
116117
$namespaces[$ns->localName] = $xml->getAttribute($ns->nodeName);

0 commit comments

Comments
 (0)