diff --git a/composer.json b/composer.json index d6571ae..7e81b24 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "ext-pcre": "*", "simplesamlphp/assert": "~1.9", - "simplesamlphp/xml-common": "~2.1" + "simplesamlphp/xml-common": "~2.4" }, "require-dev": { "simplesamlphp/simplesamlphp-test-framework": "~1.10" diff --git a/src/SOAP11/Utils/XPath.php b/src/SOAP11/Utils/XPath.php index d8e7a8e..3fe5d3c 100644 --- a/src/SOAP11/Utils/XPath.php +++ b/src/SOAP11/Utils/XPath.php @@ -19,13 +19,15 @@ class XPath extends \SimpleSAML\XPath\XPath * Get a DOMXPath object that can be used to search for SAML elements. * * @param \DOMNode $node The document to associate to the DOMXPath object. + * @param bool $autoregister Whether to auto-register all namespaces used in the document * * @return \DOMXPath A DOMXPath object ready to use in the given document, with several * saml-related namespaces already registered. */ - public static function getXPath(DOMNode $node): DOMXPath + public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath { - $xp = parent::getXPath($node); + $xp = parent::getXPath($node, $autoregister); + $xp->registerNamespace('env11', C::NS_SOAP_ENV); $xp->registerNamespace('enc11', C::NS_SOAP_ENC); diff --git a/src/SOAP12/Utils/XPath.php b/src/SOAP12/Utils/XPath.php index b325338..42ab51c 100644 --- a/src/SOAP12/Utils/XPath.php +++ b/src/SOAP12/Utils/XPath.php @@ -19,13 +19,15 @@ class XPath extends \SimpleSAML\XPath\XPath * Get a DOMXPath object that can be used to search for SAML elements. * * @param \DOMNode $node The document to associate to the DOMXPath object. + * @param bool $autoregister Whether to auto-register all namespaces used in the document * * @return \DOMXPath A DOMXPath object ready to use in the given document, with several * saml-related namespaces already registered. */ - public static function getXPath(DOMNode $node): DOMXPath + public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath { - $xp = parent::getXPath($node); + $xp = parent::getXPath($node, $autoregister); + $xp->registerNamespace('env12', C::NS_SOAP_ENV); $xp->registerNamespace('enc12', C::NS_SOAP_ENC);