Skip to content

Commit

Permalink
Fix deprecated xml function in PHP 8.X
Browse files Browse the repository at this point in the history
  • Loading branch information
torinfo committed Sep 13, 2021
1 parent 94a375b commit 5bf4995
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions website_code/php/xwdInspector.php
Expand Up @@ -38,7 +38,7 @@ private function isValidXml($string)
$orig_error_setting = libxml_use_internal_errors(true);
// See security note elsewhere in this file and http://php.net/manual/en/function.libxml-disable-entity-loader.php
// Supported from 5.2.11, so allow for older versions to work as well.
if (function_exists('libxml_disable_entity_loader'))
if (function_exists('libxml_disable_entity_loader') && \PHP_VERSION_ID < 80000)
{
$original_el_setting = libxml_disable_entity_loader(false);
}
Expand All @@ -57,7 +57,7 @@ private function isValidXml($string)
} else {
$ok = true;
}
if (function_exists('libxml_disable_entity_loader'))
if (function_exists('libxml_disable_entity_loader') && \PHP_VERSION_ID < 80000)
{
libxml_disable_entity_loader($original_el_setting);
}
Expand All @@ -73,7 +73,7 @@ public function loadTemplateXML($name)
$this->models = array();

$orig_error_setting = libxml_use_internal_errors(true);
if (function_exists('libxml_disable_entity_loader'))
if (function_exists('libxml_disable_entity_loader') && \PHP_VERSION_ID < 80000)
{
$original_el_setting = libxml_disable_entity_loader(false);
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public function loadTemplateXML($name)
}
$this->menus[] = $menu;
}
if (function_exists('libxml_disable_entity_loader'))
if (function_exists('libxml_disable_entity_loader') && \PHP_VERSION_ID < 8000)
{
libxml_disable_entity_loader($original_el_setting);
}
Expand Down

0 comments on commit 5bf4995

Please sign in to comment.