Changeset 26053
- Timestamp:
- 11/08/2013 10:51:03 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/meta.php
r25583 r26053 754 754 if ( 'OR' == $this->relation ) { 755 755 foreach ( $this->queries as $k => $q ) { 756 if ( ! isset( $q['value']) && ! empty( $q['key'] ) )756 if ( ! array_key_exists( 'value', $q ) && ! empty( $q['key'] ) ) 757 757 $key_only_queries[$k] = $q; 758 758 else … … 774 774 $meta_key = isset( $q['key'] ) ? trim( $q['key'] ) : ''; 775 775 $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'] = ''; 776 779 777 780 $meta_value = isset( $q['value'] ) ? $q['value'] : null; -
trunk/tests/phpunit/tests/meta/query.php
r25002 r26053 106 106 107 107 } 108 109 /** 110 * @ticket 22967 111 */ 112 function test_null_value_sql() { 113 global $wpdb; 114 115 $query = new WP_Meta_Query( array( 116 array( 'key' => 'abc', 'value' => null, 'compare' => '=' ) 117 ) ); 118 $sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this ); 119 120 $this->assertEquals( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) = '')" ) ); 121 } 108 122 }
Note: See TracChangeset
for help on using the changeset viewer.