Make WordPress Core


Ignore:
Timestamp:
10/26/2014 10:56:36 PM (7 years ago)
Author:
boonebgorges
Message:

Improve WP_Tax_Query param sanitization for empty strings.

When an empty string is passed as one of the clauses in the $tax_query
parameter, it should be discarded rather than parsed as a first-order clause.

Props tmtrademark.
Fixes #30117.

File:
1 edited

Legend:

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

    r29945 r30031  
    833833     */
    834834    protected static function is_first_order_clause( $query ) {
    835         return empty( $query ) || array_key_exists( 'terms', $query ) || array_key_exists( 'taxonomy', $query ) || array_key_exists( 'include_children', $query ) || array_key_exists( 'field', $query ) || array_key_exists( 'operator', $query );
     835        return is_array( $query ) && ( empty( $query ) || array_key_exists( 'terms', $query ) || array_key_exists( 'taxonomy', $query ) || array_key_exists( 'include_children', $query ) || array_key_exists( 'field', $query ) || array_key_exists( 'operator', $query ) );
    836836    }
    837837
Note: See TracChangeset for help on using the changeset viewer.