Make WordPress Core

Changeset 28783


Ignore:
Timestamp:
06/20/2014 04:20:35 PM (12 years ago)
Author:
wonderboymusic
Message:

Revert [28613] and [28664]. A good idea, but too much BC baggage.

See #28099.

Location:
trunk
Files:
3 edited

Legend:

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

    r28737 r28783  
    18311831                                'include_children' => false
    18321832                        );
    1833                 } elseif ( isset( $this->query['category__in'] ) ) {
    1834                         $q['category__in'] = false;
    18351833                }
    18361834
     
    18901888                                'terms' => $q['tag__in']
    18911889                        );
    1892                 } elseif ( isset( $this->query['tag__in'] ) ) {
    1893                         $q['tag__in'] = false;
    18941890                }
    18951891
     
    19191915                                'field' => 'slug'
    19201916                        );
    1921                 } elseif ( isset( $this->query['tag_slug__in'] ) ) {
    1922                         $q['tag_slug__in'] = false;
    19231917                }
    19241918
     
    24542448                        $post__in = implode(',', array_map( 'absint', $q['post__in'] ));
    24552449                        $where .= " AND {$wpdb->posts}.ID IN ($post__in)";
    2456                 } elseif ( isset( $this->query['post__in'] ) ) {
    2457                         $post__in = 0;
    2458                         $where .= " AND 1=0 ";
    24592450                } elseif ( $q['post__not_in'] ) {
    24602451                        $post__not_in = implode(',',  array_map( 'absint', $q['post__not_in'] ));
     
    24672458                        $post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );
    24682459                        $where .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)";
    2469                 } elseif ( isset( $this->query['post_parent__in'] ) ) {
    2470                         $post_parent__in = 0;
    2471                         $where .= " AND 1=0 ";
    24722460                } elseif ( $q['post_parent__not_in'] ) {
    24732461                        $post_parent__not_in = implode( ',',  array_map( 'absint', $q['post_parent__not_in'] ) );
     
    25072495                        $join .= $clauses['join'];
    25082496                        $where .= $clauses['where'];
    2509                 }
    2510 
    2511                 // If *__in is passed to WP_Query as an empty array, don't return results
    2512                 foreach ( array( 'category', 'tag', 'tag_slug' ) as $in ) {
    2513                         if ( isset( $q["{$in}__in"] ) && false === $q["{$in}__in"] ) {
    2514                                 $where = " AND 1=0 $where";
    2515                         }
    25162497                }
    25172498
     
    26072588                        $author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );
    26082589                        $where .= " AND {$wpdb->posts}.post_author IN ($author__in) ";
    2609                 } elseif ( isset( $this->query['author__in'] ) ) {
    2610                         $author__in = 0;
    2611                         $where .= ' AND 1=0 ';
    26122590                }
    26132591
  • trunk/tests/phpunit/tests/query/results.php

    r28664 r28783  
    403403        }
    404404
     405        /**
     406         * @ticket 28099
     407         */
    405408        function test_empty_post__in() {
    406409                $posts1 = $this->q->query( array() );
    407410                $this->assertNotEmpty( $posts1 );
    408411                $posts2 = $this->q->query( array( 'post__in' => array() ) );
    409                 $this->assertEmpty( $posts2 );
     412                $this->assertNotEmpty( $posts2 );
    410413                $posts3 = $this->q->query( array( 'post_parent__in' => array() ) );
    411                 $this->assertEmpty( $posts3 );
     414                $this->assertNotEmpty( $posts3 );
    412415        }
    413416
     
    515518
    516519                $posts = $this->q->query( array( 'author__in' => array() ) );
    517                 $this->assertEmpty( $posts );
     520                $this->assertNotEmpty( $posts );
    518521
    519522                $posts = $this->q->query( array(
  • trunk/tests/phpunit/tests/term/query.php

    r28664 r28783  
    204204        }
    205205
     206        /**
     207         * @ticket 28099
     208         */
    206209        function test_empty__in() {
    207210                $cat_id = $this->factory->category->create();
     
    212215                $this->assertNotEmpty( $q1 );
    213216                $q2 = get_posts( array( 'category__in' => array() ) );
    214                 $this->assertEmpty( $q2 );
     217                $this->assertNotEmpty( $q2 );
    215218
    216219                $tag = wp_insert_term( 'woo', 'post_tag' );
     
    222225                $this->assertNotEmpty( $q3 );
    223226                $q4 = get_posts( array( 'tag__in' => array() ) );
    224                 $this->assertEmpty( $q4 );
     227                $this->assertNotEmpty( $q4 );
    225228
    226229                $q5 = get_posts( array( 'tag_slug__in' => array( $slug ) ) );
    227230                $this->assertNotEmpty( $q5 );
    228231                $q6 = get_posts( array( 'tag_slug__in' => array() ) );
    229                 $this->assertEmpty( $q6 );
     232                $this->assertNotEmpty( $q6 );
    230233        }
    231234}
Note: See TracChangeset for help on using the changeset viewer.