Skip to content

Commit

Permalink
Fix deprecated call in PHP 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Dec 6, 2020
1 parent 98f7943 commit 3f8b1cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ResponseParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public function parseDocument() : \DOMDocument
$charset = (isset($matches[2]) ? $matches[2] : 'UTF-8');

$useInternalErrors = libxml_use_internal_errors(true);
$disableEntityLoader = libxml_disable_entity_loader(true);

if (version_compare(PHP_VERSION, '8.0.0') < 0) {
$disableEntityLoader = libxml_disable_entity_loader(true);
}

$document = new \DOMDocument('1.0', $charset);
$document->validateOnParse = true;
Expand All @@ -74,7 +77,10 @@ public function parseDocument() : \DOMDocument
}

libxml_use_internal_errors($useInternalErrors);
libxml_disable_entity_loader($disableEntityLoader);

if (version_compare(PHP_VERSION, '8.0.0') < 0) {
libxml_disable_entity_loader($disableEntityLoader);
}

return $document;
}
Expand Down

0 comments on commit 3f8b1cf

Please sign in to comment.