From f97d313c0f8b21279aa06e0cd1ee183687921df6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 11 Jul 2016 00:09:46 +0200 Subject: [PATCH] Ensure dom fragment is never empty in terms of child nodes --- .../html/input/node/HtmlInputNodeWoltlabMetacode.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php index 8b8251d838..9311e2c91f 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php @@ -74,7 +74,10 @@ class HtmlInputNodeWoltlabMetacode extends AbstractHtmlInputNode { /** @var IMetacodeConverter $converter */ if ($converter->validateAttributes($attributes)) { - $newElement = $converter->convert(DOMUtil::childNodesToFragment($element), $attributes); + $fragment = DOMUtil::childNodesToFragment($element); + if (!$fragment->hasChildNodes()) $fragment->appendChild($fragment->ownerDocument->createTextNode('')); + + $newElement = $converter->convert($fragment, $attributes); if (!($newElement instanceof \DOMElement)) { throw new \UnexpectedValueException("Expected a valid DOMElement as return value."); } -- 2.20.1