Changeset 54888
- Timestamp:
- 11/28/2022 07:42:56 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
src/wp-includes/comment.php (modified) (2 diffs)
-
tests/phpunit/tests/comment/checkComment.php (modified) (2 diffs)
-
tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r54877 r54888 98 98 * fail the check for the given field by returning false. 99 99 */ 100 $pattern = "#$word#i ";100 $pattern = "#$word#iu"; 101 101 if ( preg_match( $pattern, $author ) ) { 102 102 return false; … … 1358 1358 $word = preg_quote( $word, '#' ); 1359 1359 1360 $pattern = "#$word#i ";1360 $pattern = "#$word#iu"; 1361 1361 if ( preg_match( $pattern, $author ) 1362 1362 || preg_match( $pattern, $email ) -
trunk/tests/phpunit/tests/comment/checkComment.php
r54090 r54888 71 71 } 72 72 73 public function test_should_return_false_when_content_matches_moderation_key () {73 public function test_should_return_false_when_content_matches_moderation_keys() { 74 74 update_option( 'comment_previously_approved', 0 ); 75 75 … … 83 83 84 84 update_option( 'moderation_keys', "foo\nbar\nscoop" ); 85 $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type ); 86 $this->assertFalse( $results ); 87 } 88 89 /** 90 * @ticket 57207 91 */ 92 public function test_should_return_false_when_content_with_non_latin_words_matches_moderation_keys() { 93 update_option( 'comment_previously_approved', 0 ); 94 95 $author = 'Setup'; 96 $author_email = 'setup@example.com'; 97 $author_url = 'http://example.com'; 98 $comment = 'Установка'; 99 $author_ip = '192.168.0.1'; 100 $user_agent = ''; 101 $comment_type = ''; 102 103 update_option( 'moderation_keys', "установка\nfoo" ); 85 104 $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type ); 86 105 $this->assertFalse( $results ); -
trunk/tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php
r54704 r54888 35 35 36 36 update_option( 'disallowed_keys', "halfway\nfoo" ); 37 38 $result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent ); 39 40 $this->assertTrue( $result ); 41 } 42 43 /** 44 * @ticket 57207 45 */ 46 public function test_should_return_true_when_content_with_non_latin_words_matches_disallowed_keys() { 47 $author = 'Setup'; 48 $author_email = 'setup@example.com'; 49 $author_url = 'http://example.com'; 50 $comment = 'Установка'; 51 $author_ip = '192.168.0.1'; 52 $user_agent = ''; 53 54 update_option( 'disallowed_keys', "установка\nfoo" ); 37 55 38 56 $result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
Note: See TracChangeset
for help on using the changeset viewer.