summaryrefslogtreecommitdiff
path: root/classes/sanitizer.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-06 17:19:07 +0300
committerAndrew Dolgov <[email protected]>2021-02-06 17:19:07 +0300
commitb6e1a5c91a0999a13eda4207fc23ff495637d697 (patch)
treecf4979adb09176a59fa14f8611db07f62909ef71 /classes/sanitizer.php
parentce2335deafa532ed6d69a06ef1e330345af5c7bd (diff)
fix several warnings reported by phpstan
Diffstat (limited to 'classes/sanitizer.php')
-rw-r--r--classes/sanitizer.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/classes/sanitizer.php b/classes/sanitizer.php
index 9ca4200a5..5a054c3b0 100644
--- a/classes/sanitizer.php
+++ b/classes/sanitizer.php
@@ -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);
}