mirror of
https://github.com/friendica/friendica
synced 2025-04-21 12:30:10 +00:00
Fix removing falsy text nodes in HTML::tagToBBCodeSub
- This wrongly removed text nodes containing just '0'
This commit is contained in:
parent
df559a24c0
commit
3e1b6890b7
2 changed files with 7 additions and 3 deletions
|
@ -114,7 +114,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 || $child->nodeName != '#text' || 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);
|
||||
}
|
||||
|
@ -144,10 +144,10 @@ class HTML
|
|||
public static function toBBCode(string $message, string $basepath = ''): string
|
||||
{
|
||||
/*
|
||||
* Check if message is empty to prevent a lot code below being executed
|
||||
* Check if message is empty to prevent a lot of code below from being executed
|
||||
* for just an empty message.
|
||||
*/
|
||||
if (empty($message)) {
|
||||
if ($message === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue