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. git-svn-id: https://develop.svn.wordpress.org/trunk@36113 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a9b9aa65b9
commit
26d7619306
@ -687,7 +687,7 @@ function post_exists($title, $content = '', $date = '') {
|
||||
}
|
||||
|
||||
if ( !empty ( $content ) ) {
|
||||
$query .= 'AND post_content = %s';
|
||||
$query .= ' AND post_content = %s';
|
||||
$args[] = $post_content;
|
||||
}
|
||||
|
||||
|
@ -481,6 +481,20 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
||||
$this->assertSame( $p, post_exists( $title, $content ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35246
|
||||
*/
|
||||
public function test_post_exists_should_match_content_with_no_title() {
|
||||
$title = '';
|
||||
$content = 'Foo Bar Baz';
|
||||
$p = self::factory()->post->create( array(
|
||||
'post_title' => $title,
|
||||
'post_content' => $content,
|
||||
) );
|
||||
|
||||
$this->assertSame( $p, post_exists( $title, $content ) );
|
||||
}
|
||||
|
||||
public function test_post_exists_should_not_match_when_nonempty_content_doesnt_match() {
|
||||
$title = 'Foo Bar';
|
||||
$content = 'Foo Bar Baz';
|
||||
|
Loading…
Reference in New Issue
Block a user