From e43ff0e9914941d635a898a1a04af87f76eb35cf Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 30 Sep 2020 12:09:08 +0000 Subject: [PATCH] Code Modernization: Return `false` from `wpdb::query()` if the query was filtered to an empty string using the `query` filter. This avoids a fatal error on PHP 8 caused by passing an empty string to `mysqli_query()`, and maintains the current behaviour. Follow-up to [48980], [48981]. See #50913, #50639. Built from https://develop.svn.wordpress.org/trunk@49072 git-svn-id: http://core.svn.wordpress.org/trunk@48834 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/wp-db.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index f717b9c8c6..ff7dfb6f77 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49071'; +$wp_version = '5.6-alpha-49072'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index ebcadb6ef0..80c117c1a0 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1915,6 +1915,11 @@ class wpdb { */ $query = apply_filters( 'query', $query ); + if ( ! $query ) { + $this->insert_id = 0; + return false; + } + $this->flush(); // Log how the function was called.