Skip to content

Commit

Permalink
Escape underscores in queries to avoid wildcard query
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Sep 20, 2017
1 parent 88b8287 commit ef97ca1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/wp-background-process.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected function is_queue_empty() {
$column = 'meta_key';
}

$key = $this->identifier . '_batch_%';
$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';

$count = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT(*)
Expand Down Expand Up @@ -270,7 +270,7 @@ protected function get_batch() {
$value_column = 'meta_value';
}

$key = $this->identifier . '_batch_%';
$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';

$query = $wpdb->get_row( $wpdb->prepare( "
SELECT *
Expand Down

0 comments on commit ef97ca1

Please sign in to comment.