From 776396962514770a3740ea847182ed0bd614d85c Mon Sep 17 00:00:00 2001 From: Ruben Calvo Date: Tue, 9 Jul 2024 17:09:06 +0200 Subject: [PATCH] [ticket/15403] Return first fragment of text if there is no coincidences PHPBB-15403 --- phpBB/includes/functions_content.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 5b1d6244b3..e536c5ad24 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -399,10 +399,10 @@ function get_context($text, $words, $length = 400) // Get the last fragment $fragments[] = $fragment; - $output = htmlentities(implode('', $fragments)); + return htmlentities(implode('', $fragments)); } - return $output; + return htmlentities($text_length >= $length + 3 ? utf8_substr($text, 0, $length) . ' ...' : $text); } /**