Ticket #32585: 32585.diff
File 32585.diff, 1.8 KB (added by , 5 years ago) |
---|
-
src/wp-includes/post-functions.php
3042 3042 3043 3043 // These variables are needed by compact() later. 3044 3044 $post_content_filtered = $postarr['post_content_filtered']; 3045 $post_author = empty( $postarr['post_author'] ) ? $user_id : $postarr['post_author'];3045 $post_author = isset( $postarr['post_author'] ) ? $postarr['post_author'] : $user_id; 3046 3046 $ping_status = empty( $postarr['ping_status'] ) ? get_default_comment_status( $post_type, 'pingback' ) : $postarr['ping_status']; 3047 3047 $to_ping = isset( $postarr['to_ping'] ) ? sanitize_trackback_urls( $postarr['to_ping'] ) : ''; 3048 3048 $pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : ''; -
tests/phpunit/tests/post.php
1200 1200 // Teardown 1201 1201 wp_set_current_user( $old_uid ); 1202 1202 } 1203 1204 /** 1205 * @ticket 32585 1206 */ 1207 public function test_wp_insert_post_author_zero() { 1208 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 1209 1210 wp_set_current_user( $user_id ); 1211 1212 $post_id = $this->factory->post->create( array( 'post_author' => 0 ) ); 1213 1214 $this->assertEquals( 0, get_post( $post_id )->post_author ); 1215 } 1216 1217 /** 1218 * @ticket 32585 1219 */ 1220 public function test_wp_insert_post_author_null() { 1221 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 1222 1223 wp_set_current_user( $user_id ); 1224 1225 $post_id = $this->factory->post->create( array( 'post_author' => null ) ); 1226 1227 $this->assertEquals( $user_id, get_post( $post_id )->post_author ); 1228 } 1203 1229 }