From ce59109919adc75d3803e501c482a0df15f22ab1 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 10 Jun 2014 02:19:30 +0000 Subject: [PATCH] In `WP_Comment_Query::get_search_sql()`, don't double-like-escape. Props miqrogroove. See #10041. git-svn-id: https://develop.svn.wordpress.org/trunk@28720 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index eaabee66a0..e69fe3a496 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -483,9 +483,12 @@ class WP_Comment_Query { protected function get_search_sql( $string, $cols ) { global $wpdb; + $like = '%' . $wpdb->esc_like( $string ) . '%'; + $searches = array(); - foreach ( $cols as $col ) - $searches[] = $wpdb->prepare( "$col LIKE %s", $wpdb->esc_like( $string ) ); + foreach ( $cols as $col ) { + $searches[] = $wpdb->prepare( "$col LIKE %s", $like ); + } return ' AND (' . implode(' OR ', $searches) . ')'; }