From: Alexander Ebert Date: Wed, 21 Dec 2016 08:42:17 +0000 (+0100) Subject: `nodeValue` trips over entities when used w/ elements X-Git-Tag: 3.0.0_RC_2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a8793d6e848cdafab80f0c8e42a273fafb405825;p=GitHub%2FWoltLab%2FWCF.git `nodeValue` trips over entities when used w/ elements --- diff --git a/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php b/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php index 4078e8cf4e..41c06eadcd 100644 --- a/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php @@ -100,7 +100,8 @@ abstract class AbstractHtmlInputNodeProcessorListener implements IParameterizedE throw new ImplementationException(get_class($object), ITitledObject::class); } - $element->nodeValue = $object->getTitle(); + $element->nodeValue = ''; + $element->appendChild($element->ownerDocument->createTextNode($object->getTitle())); } } } diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php index 320c464caf..dd4e836f8f 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php @@ -393,7 +393,7 @@ class HtmlInputNodeTextParser { $element = $text->ownerDocument->createElement('a'); $element->setAttribute('href', $link); - $element->nodeValue = $link; + $element->appendChild($element->ownerDocument->createTextNode($link)); } else { return $matches[0]; diff --git a/wcfsetup/install/files/lib/system/html/metacode/converter/CodeMetacodeConverter.class.php b/wcfsetup/install/files/lib/system/html/metacode/converter/CodeMetacodeConverter.class.php index 632b31859b..911143f8aa 100644 --- a/wcfsetup/install/files/lib/system/html/metacode/converter/CodeMetacodeConverter.class.php +++ b/wcfsetup/install/files/lib/system/html/metacode/converter/CodeMetacodeConverter.class.php @@ -100,7 +100,9 @@ class CodeMetacodeConverter extends AbstractMetacodeConverter { } // trim code block - $element->nodeValue = StringUtil::trim($element->textContent); + $content = StringUtil::trim($element->textContent); + $element->nodeValue = ''; + $element->appendChild($element->ownerDocument->createTextNode($content)); return $element; }