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
This commit is contained in:
Sergey Biryukov 2020-09-30 12:09:08 +00:00
parent b3b8942dfc
commit e43ff0e991
2 changed files with 6 additions and 1 deletions

View File

@ -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.

View File

@ -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.