Loading src/Component/XmlParserTrait.php +14 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ trait XmlParserTrait { * The previous value of the entity loader. * * @var bool * * @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. */ protected static $_entityLoader; Loading Loading @@ -75,7 +77,15 @@ trait XmlParserTrait { */ protected static function startXmlErrorHandling() { static::$_useError = libxml_use_internal_errors(TRUE); // This mitigates a security issue in libxml older than version 2.9.0. // See http://symfony.com/blog/security-release-symfony-2-0-17-released for // details. // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { static::$_entityLoader = libxml_disable_entity_loader(TRUE); } libxml_clear_errors(); } Loading @@ -92,8 +102,12 @@ trait XmlParserTrait { } libxml_clear_errors(); libxml_use_internal_errors(static::$_useError); // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { libxml_disable_entity_loader(static::$_entityLoader); } } /** * Returns the errors reported during parsing. Loading src/Utility/Feed.php +11 −0 Original line number Diff line number Diff line Loading @@ -69,12 +69,23 @@ class Feed { */ public static function findFeed($url, $html) { $use_error = libxml_use_internal_errors(TRUE); // This mitigates a security issue in libxml older than version 2.9.0. // See http://symfony.com/blog/security-release-symfony-2-0-17-released for // details. // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { $entity_loader = libxml_disable_entity_loader(TRUE); } $dom = new \DOMDocument(); $status = $dom->loadHTML(trim($html)); // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { libxml_disable_entity_loader($entity_loader); } libxml_use_internal_errors($use_error); if (!$status) { Loading Loading
src/Component/XmlParserTrait.php +14 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ trait XmlParserTrait { * The previous value of the entity loader. * * @var bool * * @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. */ protected static $_entityLoader; Loading Loading @@ -75,7 +77,15 @@ trait XmlParserTrait { */ protected static function startXmlErrorHandling() { static::$_useError = libxml_use_internal_errors(TRUE); // This mitigates a security issue in libxml older than version 2.9.0. // See http://symfony.com/blog/security-release-symfony-2-0-17-released for // details. // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { static::$_entityLoader = libxml_disable_entity_loader(TRUE); } libxml_clear_errors(); } Loading @@ -92,8 +102,12 @@ trait XmlParserTrait { } libxml_clear_errors(); libxml_use_internal_errors(static::$_useError); // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { libxml_disable_entity_loader(static::$_entityLoader); } } /** * Returns the errors reported during parsing. Loading
src/Utility/Feed.php +11 −0 Original line number Diff line number Diff line Loading @@ -69,12 +69,23 @@ class Feed { */ public static function findFeed($url, $html) { $use_error = libxml_use_internal_errors(TRUE); // This mitigates a security issue in libxml older than version 2.9.0. // See http://symfony.com/blog/security-release-symfony-2-0-17-released for // details. // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { $entity_loader = libxml_disable_entity_loader(TRUE); } $dom = new \DOMDocument(); $status = $dom->loadHTML(trim($html)); // @todo remove when Drupal 9 (and thus PHP 7) is no longer supported. if (\PHP_VERSION_ID < 80000) { libxml_disable_entity_loader($entity_loader); } libxml_use_internal_errors($use_error); if (!$status) { Loading