mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Comments: Make moderated or disallowed key check case-insensitive for non-Latin words.
The `check_comment()` and `wp_check_comment_disallowed_list()` functions are expected to be case-insensitive, but that only worked for words using Latin script and consisting of ASCII characters. This commit adds the Unicode flag to the regular expression used for the check in these functions, so that both pattern and subject can be treated as UTF-8 strings. Reference: [https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php PHP Manual: Pattern Modifiers]. Follow-up to [984], [2075], [48121], [48575]. Props bonjour52, SergeyBiryukov. Fixes #57207. Built from https://develop.svn.wordpress.org/trunk@54888 git-svn-id: http://core.svn.wordpress.org/trunk@54440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3884bd3c6e
commit
b105e59c23
@ -97,7 +97,7 @@ function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent,
|
||||
* Check the comment fields for moderation keywords. If any are found,
|
||||
* fail the check for the given field by returning false.
|
||||
*/
|
||||
$pattern = "#$word#i";
|
||||
$pattern = "#$word#iu";
|
||||
if ( preg_match( $pattern, $author ) ) {
|
||||
return false;
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $use
|
||||
// in the spam words don't break things:
|
||||
$word = preg_quote( $word, '#' );
|
||||
|
||||
$pattern = "#$word#i";
|
||||
$pattern = "#$word#iu";
|
||||
if ( preg_match( $pattern, $author )
|
||||
|| preg_match( $pattern, $email )
|
||||
|| preg_match( $pattern, $url )
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-alpha-54887';
|
||||
$wp_version = '6.2-alpha-54888';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user