Ticket #34954: 34954.1.patch
| File 34954.1.patch, 1.5 KB (added by , 10 years ago) |
|---|
-
src/wp-includes/comment.php
1904 1904 } 1905 1905 1906 1906 // Make sure that the comment post ID is valid (if specified). 1907 if ( isset( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) {1907 if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) { 1908 1908 return 0; 1909 1909 } 1910 1910 -
tests/phpunit/tests/comment.php
70 70 $this->assertEquals( 1, $comment->user_id ); 71 71 } 72 72 73 /** 74 * @ticket 34954 75 */ 76 function test_wp_update_comment_with_no_post_id() { 77 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => 0 ) ); 78 79 $updated_comment_text = 'I should be able to update a comment with a Post ID of zero'; 80 81 $update = wp_update_comment( array( 'comment_ID' => $comment_id, 'comment_content' => $updated_comment_text, 'comment_post_ID' => 0 ) ); 82 83 $this->assertEquals( 1, $update ); 84 85 $comment = get_comment( $comment_id ); 86 $this->assertEquals( $updated_comment_text, $comment->comment_content ); 87 } 88 73 89 public function test_get_approved_comments() { 74 90 $ca1 = self::factory()->comment->create( array( 75 91 'comment_post_ID' => self::$post_id, 'comment_approved' => '1'