From: Hypolite Petovan Date: Wed, 7 Aug 2019 01:22:19 +0000 (-0400) Subject: Ensure trimmed HTML nodes are text nodes in HTML::toBBCode X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=246894f233c41ff8c7e75668d06a32f853364e96;p=friendica.git Ensure trimmed HTML nodes are text nodes in HTML::toBBCode --- diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php index 688895da92..c8bed0b9d6 100644 --- a/src/Content/Text/HTML.php +++ b/src/Content/Text/HTML.php @@ -102,7 +102,7 @@ class HTML /** @var \DOMNode $child */ foreach ($node->childNodes as $key => $child) { /* Remove empty text nodes at the start or at the end of the children list */ - if ($key > 0 && $key < $node->childNodes->length - 1 || trim($child->nodeValue)) { + if ($key > 0 && $key < $node->childNodes->length - 1 || $child->nodeName != '#text' || trim($child->nodeValue)) { $newNode = $child->cloneNode(true); $node->parentNode->insertBefore($newNode, $node); }