1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 11:05:55 +00:00

fix several warnings reported by phpstan

This commit is contained in:
Andrew Dolgov
2021-02-06 17:19:07 +03:00
parent ce2335deaf
commit b6e1a5c91a
7 changed files with 55 additions and 51 deletions

View File

@@ -188,16 +188,16 @@ class Sanitizer {
$text = $child->textContent;
while (($pos = mb_stripos($text, $word)) !== false) {
$fragment->appendChild(new DomText(mb_substr($text, 0, $pos)));
$word = mb_substr($text, $pos, mb_strlen($word));
$fragment->appendChild(new DOMText(mb_substr($text, 0, (int)$pos)));
$word = mb_substr($text, (int)$pos, mb_strlen($word));
$highlight = $doc->createElement('span');
$highlight->appendChild(new DomText($word));
$highlight->appendChild(new DOMText($word));
$highlight->setAttribute('class', 'highlight');
$fragment->appendChild($highlight);
$text = mb_substr($text, $pos + mb_strlen($word));
}
if (!empty($text)) $fragment->appendChild(new DomText($text));
if (!empty($text)) $fragment->appendChild(new DOMText($text));
$child->parentNode->replaceChild($fragment, $child);
}