From querypath created by anhta: technosophos/querypath#177
You should check for $r === FALSE and throw exception after this piece of codes in DOMQuery::parseXMLFile() as load() and loadHTMLFile() methods of DOMDocument can return FALSE on failure:
if ($useParser == 'xml') {
$r = $document->load($filename, $flags);
}
// Otherwise, see if it looks like HTML.
elseif (isset($htmlExtensions[$ext]) || $useParser == 'html') {
// Try parsing it as HTML.
$r = $document->loadHTMLFile($filename);
}
// Default to XML.
else {
$r = $document->load($filename, $flags);
}
Feel free to open a PR, and I'l take a look. That'd be a fairly big change, and would likely break many applications, so it'd probably require a major version number increment.
From querypath created by anhta: technosophos/querypath#177
You should check for $r === FALSE and throw exception after this piece of codes in DOMQuery::parseXMLFile() as load() and loadHTMLFile() methods of DOMDocument can return FALSE on failure: