From 87da39a77bce2660e77565136de0530b757267cb Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Fri, 17 Oct 2008 08:13:55 +0000 Subject: Fixed a preg_replace bug if the supplied string contains the delimiter --- system/helpers/text_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 9f13896ae..8a4460825 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -236,11 +236,11 @@ if ( ! function_exists('word_censor')) { if ($replacement != '') { - $str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword)).")\b/i", $replacement, $str); + $str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")\b/i", $replacement, $str); } else { - $str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword)).")\b/ie", "str_repeat('#', strlen('\\1'))", $str); + $str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")\b/ie", "str_repeat('#', strlen('\\1'))", $str); } } -- cgit v1.2.3-24-g4f1b