diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php
index ccbf10c..a120b58 100644
|
a
|
b
|
class WP_Comment_Query { |
| 745 | 745 | $this->sql_clauses['where']['user_id'] = $wpdb->prepare( 'user_id = %d', $this->query_vars['user_id'] ); |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | | if ( '' !== $this->query_vars['search'] ) { |
| | 748 | if ( ! in_array( $this->query_vars['search'], array( '', null, false ), true ) ) { |
| 749 | 749 | $search_sql = $this->get_search_sql( |
| 750 | 750 | $this->query_vars['search'], |
| 751 | 751 | array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) |
diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php
index 88fe55e..e787dfc 100644
|
a
|
b
|
class Tests_Comment_Query extends WP_UnitTestCase { |
| 1142 | 1142 | $this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c5 ), $found ); |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| | 1145 | public function test_search_falsy_arg() { |
| | 1146 | $q = new WP_Comment_Query(); |
| | 1147 | $q->query( array( |
| | 1148 | 'search' => false, |
| | 1149 | ) ); |
| | 1150 | $this->assertNotContains( "comment_author LIKE '%%'", $q->request ); |
| | 1151 | $q->query( array( |
| | 1152 | 'search' => null, |
| | 1153 | ) ); |
| | 1154 | $this->assertNotContains( "comment_author LIKE '%%'", $q->request ); |
| | 1155 | $q->query( array( |
| | 1156 | 'search' => '', |
| | 1157 | ) ); |
| | 1158 | $this->assertNotContains( "comment_author LIKE '%%'", $q->request ); |
| | 1159 | $q->query( array( |
| | 1160 | 'search' => 'foo', |
| | 1161 | ) ); |
| | 1162 | $this->assertContains( "comment_author LIKE '%foo%'", $q->request ); |
| | 1163 | $q->query( array( |
| | 1164 | 'search' => '0', |
| | 1165 | ) ); |
| | 1166 | $this->assertContains( "comment_author LIKE '%0%'", $q->request ); |
| | 1167 | } |
| | 1168 | |
| 1145 | 1169 | public function test_orderby_default() { |
| 1146 | 1170 | global $wpdb; |
| 1147 | 1171 | |