From 1039a6fed19884d77928ebdfc4a60ff62217a72b Mon Sep 17 00:00:00 2001 From: Dougal Campbell Date: Fri, 5 Nov 2004 03:56:40 +0000 Subject: [PATCH] BUGFIX: prevent '#' chars in moderation_keys from breaking regex handling. git-svn-id: https://develop.svn.wordpress.org/trunk@1845 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 3c3f0a98a1..30db041e10 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1677,7 +1677,11 @@ function check_comment($author, $email, $url, $comment, $user_ip) { // Skip empty lines if (empty($word)) { continue; } - $pattern = "#$word#i"; + // Do some escaping magic so that '#' chars in the + // spam words don't break things: + $word = preg_replace('/(\\\\|#)/','\\\\$1',$word); + + $pattern = "#$word#i"; if ( preg_match($pattern, $author) ) return false; if ( preg_match($pattern, $email) ) return false; if ( preg_match($pattern, $url) ) return false;