diff --git a/Sources/Actions/MessageIndex.php b/Sources/Actions/MessageIndex.php
index 64f68005a9..3736ea9f92 100644
--- a/Sources/Actions/MessageIndex.php
+++ b/Sources/Actions/MessageIndex.php
@@ -247,7 +247,7 @@ public static function buildTopicContext(array $row): void
$row['first_body'] = strip_tags(strtr(BBCodeParser::load()->parse($row['first_body'], (bool) $row['first_smileys'], (int) $row['id_first_msg']), ['
' => '
']));
if (Utils::entityStrlen($row['first_body']) > Config::$modSettings['preview_characters']) {
- $row['first_body'] = Utils::entitySubstr($row['first_body'], 0, Config::$modSettings['preview_characters']) . '...';
+ $row['first_body'] = Utils::entitySubstr($row['first_body'], 0, (int) Config::$modSettings['preview_characters']) . '...';
}
// Censor the subject and message preview.
@@ -262,7 +262,7 @@ public static function buildTopicContext(array $row): void
$row['last_body'] = strip_tags(strtr(BBCodeParser::load()->parse($row['last_body'], (bool) $row['last_smileys'], (int) $row['id_last_msg']), ['
' => '
']));
if (Utils::entityStrlen($row['last_body']) > Config::$modSettings['preview_characters']) {
- $row['last_body'] = Utils::entitySubstr($row['last_body'], 0, Config::$modSettings['preview_characters']) . '...';
+ $row['last_body'] = Utils::entitySubstr($row['last_body'], 0, (int) Config::$modSettings['preview_characters']) . '...';
}
Lang::censorText($row['last_subject']);
diff --git a/Sources/BBCodeParser.php b/Sources/BBCodeParser.php
index a2b8da7872..f38734e17b 100644
--- a/Sources/BBCodeParser.php
+++ b/Sources/BBCodeParser.php
@@ -4216,6 +4216,7 @@ protected function resetRuntimeProperties(): void
// Reset these properties.
$to_reset = [
'message',
+ 'bbc_codes',
'smileys',
'parse_tags',
'open_tags',