/** @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);
}
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 '';
}
'html' => "<p>Now playing</p><pre><code>echo "main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}" | gcc -o a.out -x c - 2> /dev/null
./a.out | aplay -q 2> /dev/null</code></pre><p>its surprisingly good</p>",
],
+ 'bug-11851-content-0' => [
+ 'expectedBBCode' => '[url=https://dev-friendica.mrpetovan.com/profile/hypolite]@hypolite[/url] 0',
+ 'html' => '<p><span class="h-card"><a href="https://dev-friendica.mrpetovan.com/profile/hypolite" class="u-url mention">@<span>hypolite</span></a></span> 0</p>',
+ ],
];
}