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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user