Fix deprecated libxml_disable_entity_loader
This commit is contained in:
parent
3a04739a83
commit
18c19356ee
@ -1184,7 +1184,9 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
$htmlContent = $this->convertToHtmlEntities($htmlContent, $charset);
|
||||
|
||||
$internalErrors = libxml_use_internal_errors(true);
|
||||
$disableEntities = libxml_disable_entity_loader(true);
|
||||
if (LIBXML_VERSION < 20900) {
|
||||
$disableEntities = libxml_disable_entity_loader(true);
|
||||
}
|
||||
|
||||
$dom = new \DOMDocument('1.0', $charset);
|
||||
$dom->validateOnParse = true;
|
||||
@ -1194,7 +1196,9 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
}
|
||||
|
||||
libxml_use_internal_errors($internalErrors);
|
||||
libxml_disable_entity_loader($disableEntities);
|
||||
if (LIBXML_VERSION < 20900) {
|
||||
libxml_disable_entity_loader($disableEntities);
|
||||
}
|
||||
|
||||
return $dom;
|
||||
}
|
||||
|
@ -61,16 +61,22 @@ class XliffUtils
|
||||
{
|
||||
$xliffVersion = static::getVersionNumber($dom);
|
||||
$internalErrors = libxml_use_internal_errors(true);
|
||||
$disableEntities = libxml_disable_entity_loader(false);
|
||||
if (LIBXML_VERSION < 20900) {
|
||||
$disableEntities = libxml_disable_entity_loader(false);
|
||||
}
|
||||
|
||||
$isValid = @$dom->schemaValidateSource(self::getSchema($xliffVersion));
|
||||
if (!$isValid) {
|
||||
libxml_disable_entity_loader($disableEntities);
|
||||
if (LIBXML_VERSION < 20900) {
|
||||
libxml_disable_entity_loader($disableEntities);
|
||||
}
|
||||
|
||||
return self::getXmlErrors($internalErrors);
|
||||
}
|
||||
|
||||
libxml_disable_entity_loader($disableEntities);
|
||||
if (LIBXML_VERSION < 20900) {
|
||||
libxml_disable_entity_loader($disableEntities);
|
||||
}
|
||||
|
||||
$dom->normalizeDocument();
|
||||
|
||||
|
Reference in New Issue
Block a user