WordPress.org

Make WordPress Core

Changeset 36113


Ignore:
Timestamp:
12/28/2015 07:06:05 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Import: Add a missing space to post_exists().

The lack of space resulted in SQL error when searching for posts by content.

Props yetAnotherDaniel, johnbillion.
Fixes #35246.

Location:
trunk
Files:
2 edited

Legend:

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

    r36000 r36113  
    688688
    689689    if ( !empty ( $content ) ) {
    690         $query .= 'AND post_content = %s';
     690        $query .= ' AND post_content = %s';
    691691        $args[] = $post_content;
    692692    }
  • trunk/tests/phpunit/tests/admin/includesPost.php

    r35245 r36113  
    482482    }
    483483
     484    /**
     485     * @ticket 35246
     486     */
     487    public function test_post_exists_should_match_content_with_no_title() {
     488        $title = '';
     489        $content = 'Foo Bar Baz';
     490        $p = self::factory()->post->create( array(
     491            'post_title' => $title,
     492            'post_content' => $content,
     493        ) );
     494
     495        $this->assertSame( $p, post_exists( $title, $content ) );
     496    }
     497
    484498    public function test_post_exists_should_not_match_when_nonempty_content_doesnt_match() {
    485499        $title = 'Foo Bar';
Note: See TracChangeset for help on using the changeset viewer.