From fdb4e2b6783fc9cd4461cf73d68107017012735b Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 28 Feb 2023 13:18:29 +1000 Subject: [PATCH] Flush the query results variables following strip_invalid_text_from_query() to ensure queries from that function does not get returned to the caller function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This merges ​https://core.trac.wordpress.org/changeset/31093 to HyperDB. --- db.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db.php b/db.php index f1a7e01..c8b3c04 100644 --- a/db.php +++ b/db.php @@ -934,6 +934,9 @@ public function query( $query ) { // If we're writing to the database, make sure the query will write safely. if ( $this->check_current_query && method_exists( $this, 'check_ascii' ) && ! $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; $this->last_error = 'Invalid query';