Skip to content

Commit

Permalink
PHP8 compatibility
Browse files Browse the repository at this point in the history
What was previously silenced, now becomes:

ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty
  • Loading branch information
mbeccati authored and sebastianbergmann committed Sep 30, 2020
1 parent e717aab commit e376d38
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/DOMNodeComparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use function strtolower;
use DOMDocument;
use DOMNode;
use ValueError;

/**
* Compares DOMNode instances for equality.
Expand Down Expand Up @@ -71,7 +72,11 @@ private function nodeToText(DOMNode $node, bool $canonicalize, bool $ignoreCase)
{
if ($canonicalize) {
$document = new DOMDocument;
@$document->loadXML($node->C14N());

try {
@$document->loadXML($node->C14N());
} catch (ValueError $e) {
}

$node = $document;
}
Expand Down

0 comments on commit e376d38

Please sign in to comment.