Make WordPress Core


Ignore:
Timestamp:
10/29/2014 07:50:31 PM (10 years ago)
Author:
boonebgorges
Message:

Support an empty string passed as a status in WP_Comment_Query.

The changes in [30084] broke backward compatibility with interfaces that
manually passed an empty string for the value of 'status', such as on
wp-admin/edit-comments.php.

Fixes #29612.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/query.php

    r30084 r30093  
    1414
    1515        $this->post_id = $this->factory->post->create();
     16    }
     17
     18    /**
     19     * @ticket 29612
     20     */
     21    public function test_status_empty_string() {
     22        $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     23        $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     24        $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );
     25
     26        $q = new WP_Comment_Query();
     27        $found = $q->query( array(
     28            'status' => '',
     29            'fields' => 'ids',
     30        ) );
     31
     32        $this->assertEqualSets( array( $c1, $c2 ), $found );
    1633    }
    1734
Note: See TracChangeset for help on using the changeset viewer.