WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/08/2013 10:51:03 PM (8 years ago)
Author:
wonderboymusic
Message:

Respect the compare operator value in meta_query when value evaluates to null. Adds Unit Test.

Props bradyvercher, gradyetc.
Fixes #22967.

File:
1 edited

Legend:

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

    r25583 r26053  
    754754        if ( 'OR' == $this->relation ) {
    755755            foreach ( $this->queries as $k => $q ) {
    756                 if ( ! isset( $q['value'] ) && ! empty( $q['key'] ) )
     756                if ( ! array_key_exists( 'value', $q ) && ! empty( $q['key'] ) )
    757757                    $key_only_queries[$k] = $q;
    758758                else
     
    774774            $meta_key = isset( $q['key'] ) ? trim( $q['key'] ) : '';
    775775            $meta_type = $this->get_cast_for_type( isset( $q['type'] ) ? $q['type'] : '' );
     776
     777            if ( array_key_exists( 'value', $q ) && is_null( $q['value'] ) )
     778                $q['value'] = '';
    776779
    777780            $meta_value = isset( $q['value'] ) ? $q['value'] : null;
Note: See TracChangeset for help on using the changeset viewer.