aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 48b64f8092..17c15fda30 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2085,7 +2085,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
* Generates a text with approx. the specified length which contains the specified words and their context
*
* @param string $text The full text from which context shall be extracted
-* @param string $words An array of words which should be contained in the result, * is allowed as a wildcard
+* @param string $words An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
* @param int $length The desired length of the resulting text, however the result might be shorter or longer than this value
*
* @return string Context of the specified words seperated by "..."
@@ -2102,7 +2102,7 @@ function get_context($text, $words, $length = 400)
// find the starting indizes of all words
foreach ($words as $word)
{
- if (preg_match('#(?:[^\w]|^)(' . str_replace('\*', '\w*?', preg_quote($word, '#')) . ')(?:[^\w]|$)#i', $text, $match))
+ if (preg_match('#(?:[^\w]|^)(' . $word . ')(?:[^\w]|$)#i', $text, $match))
{
$pos = strpos($text, $match[1]);
if ($pos !== false)