Fix Unicode in smiley titles
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 16 Aug 2021 07:09:10 +0000 (09:09 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 16 Aug 2021 07:09:10 +0000 (09:09 +0200)
see 5d0bf3ec233f62c6a5a68629e32b7eaa8c9d1dd3
see #4156

wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php

index 72e1968c69601b8022eeb0e428d8dd87cd61c151..2a3ad37adc80e45c5364990d8c13359c22170654 100644 (file)
@@ -50,7 +50,10 @@ class HtmlOutputNodeImg extends AbstractHtmlOutputNode
                 } else {
                     // Ensure that the smiley's HTML is up to date.
                     $doc = new \DOMDocument();
-                    $doc->loadHTML($smiley->getHtml());
+                    $doc->loadHTML(\sprintf(
+                        '<?xml version="1.0" encoding="UTF-8"?><html><body>%s</body></html>',
+                        $smiley->getHtml()
+                    ));
                     $smileyNode = $element->ownerDocument->importNode($doc->getElementsByTagName('img')->item(0), true);
                     $element->parentNode->replaceChild($smileyNode, $element);
                 }