PHP 8.0 - depracated libxml_disable_entity_loader, is disabled by default

This commit is contained in:
Libor M 2020-10-17 15:48:39 +02:00
parent 7fd4b64e8a
commit 93978211a1
2 changed files with 12 additions and 4 deletions

View File

@ -72,7 +72,9 @@ class Html
}
// Load DOM
if (\PHP_VERSION_ID < 80000) {
$orignalLibEntityLoader = libxml_disable_entity_loader(true);
}
$dom = new \DOMDocument();
$dom->preserveWhiteSpace = $preserveWhiteSpace;
$dom->loadXML($html);
@ -80,8 +82,10 @@ class Html
$node = $dom->getElementsByTagName('body');
self::parseNode($node->item(0), $element);
if (\PHP_VERSION_ID < 80000) {
libxml_disable_entity_loader($orignalLibEntityLoader);
}
}
/**
* parse Inline style of a node

View File

@ -170,7 +170,9 @@ class TemplateProcessor
*/
protected function transformSingleXml($xml, $xsltProcessor)
{
if (\PHP_VERSION_ID < 80000) {
$orignalLibEntityLoader = libxml_disable_entity_loader(true);
}
$domDocument = new \DOMDocument();
if (false === $domDocument->loadXML($xml)) {
throw new Exception('Could not load the given XML document.');
@ -180,7 +182,9 @@ class TemplateProcessor
if (false === $transformedXml) {
throw new Exception('Could not transform the given XML document.');
}
if (\PHP_VERSION_ID < 80000) {
libxml_disable_entity_loader($orignalLibEntityLoader);
}
return $transformedXml;
}