Make WordPress Core

Changeset 49072


Ignore:
Timestamp:
09/30/2020 12:07:13 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r48981 r49072  
    19151915         */
    19161916        $query = apply_filters( 'query', $query );
     1917
     1918        if ( ! $query ) {
     1919            $this->insert_id = 0;
     1920            return false;
     1921        }
    19171922
    19181923        $this->flush();
Note: See TracChangeset for help on using the changeset viewer.