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:
parent
b3b8942dfc
commit
e43ff0e991
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue