From befcf4f4428a19f680c3f24db077eb0986ce2114 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Thu, 8 Jan 2015 08:31:42 +0000 Subject: [PATCH] WPDB: When `wpdb::query()` needs to sanity check a query string, make sure to run `wpdb:flush()` afterwards, to ensure the results from sanity check queries aren't mixed up with the results for the user query. See #21212. Fixes #30948. git-svn-id: https://develop.svn.wordpress.org/trunk@31093 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index 0f886f88f1..e7b74a6d45 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -1600,6 +1600,9 @@ class wpdb { // If we're writing to the database, make sure the query will write safely. if ( $this->check_current_query && ! $this->check_ascii( $query ) ) { $stripped_query = $this->strip_invalid_text_from_query( $query ); + // strip_invalid_text_from_query() can perform queries, so we need + // to flush again, just to make sure everything is clear. + $this->flush(); if ( $stripped_query !== $query ) { $this->insert_id = 0; return false;