From: Alexander Ebert Date: Sun, 10 Jul 2016 22:09:46 +0000 (+0200) Subject: Ensure dom fragment is never empty in terms of child nodes X-Git-Tag: 3.0.0_Beta_1~1206 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f97d313c0f8b21279aa06e0cd1ee183687921df6;p=GitHub%2FWoltLab%2FWCF.git Ensure dom fragment is never empty in terms of child nodes --- 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."); }