File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 66
77use DOMDocument ;
88use DOMNode ;
9+ use DOMNodeList ;
910use DOMXPath ;
1011use SimpleSAML \XML \Assert \Assert ;
1112use SimpleSAML \XML \Constants as C_XML ;
@@ -52,13 +53,15 @@ public static function getXPath(DOMNode $node): DOMXPath
5253 * @param \DOMNode $node The XML node.
5354 * @param string $query The query.
5455 * @param \DOMXPath $xpCache The DOMXPath object
55- * @return array<int<0, max>, \DOMNameSpaceNode|\ DOMNode|null > Array with matching DOM nodes.
56+ * @return array<\ DOMNode> Array with matching DOM nodes.
5657 */
5758 public static function xpQuery (DOMNode $ node , string $ query , DOMXPath $ xpCache ): array
5859 {
5960 $ ret = [];
6061
6162 $ results = $ xpCache ->query ($ query , $ node );
63+ Assert::notFalse ($ results , 'Malformed XPath query or invalid contextNode provided. ' );
64+
6265 for ($ i = 0 ; $ i < $ results ->length ; $ i ++) {
6366 $ ret [$ i ] = $ results ->item ($ i );
6467 }
You can’t perform that action at this time.
0 commit comments