From 390245a4aa20a5f274b1f4b28bed64ee160fbb81 Mon Sep 17 00:00:00 2001 From: COil Date: Tue, 10 Oct 2023 21:37:03 +0200 Subject: [PATCH] fix(php): fixed mb_convert_encoding deprecation --- src/Twig/Extension/MarkdownExtension.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Twig/Extension/MarkdownExtension.php b/src/Twig/Extension/MarkdownExtension.php index 189f80f..98dd584 100644 --- a/src/Twig/Extension/MarkdownExtension.php +++ b/src/Twig/Extension/MarkdownExtension.php @@ -18,11 +18,13 @@ public function getFilters(): array /** * Add the "att" attributes on all links to have the tooltips. + * + * @see https://www.drupal.org/project/smart_trim/issues/3342481#comment-14982548 */ public function addAttAttributes(string $html): string { $dom = new \DOMDocument(); - $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); + $dom->loadHTML(mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, ~0], 'UTF-8')); $aTags = $dom->getElementsByTagName('a'); foreach ($aTags as $aTag) { $aTag->setAttribute('att', '');