Changeset 29063
- Timestamp:
- 07/10/2014 02:16:20 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r28854 r29063 1104 1104 1105 1105 // convert the date field back to IXR form 1106 if ( isset( $content_struct['post_date'] ) ) {1106 if ( isset( $content_struct['post_date'] ) && ! is_a( $content_struct['post_date'], 'IXR_Date' ) ) { 1107 1107 $content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] ); 1108 1108 } … … 1110 1110 // ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct, 1111 1111 // since _insert_post will ignore the non-GMT date if the GMT date is set 1112 if ( isset( $content_struct['post_date_gmt'] ) ) {1112 if ( isset( $content_struct['post_date_gmt'] ) && ! is_a( $content_struct['post_date_gmt'], 'IXR_Date' ) ) { 1113 1113 if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) { 1114 1114 unset( $content_struct['post_date_gmt'] ); -
trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
r29062 r29063 358 358 } 359 359 360 /** 361 * @ticket 28601 362 */ 363 function test_valid_IXR_post_date() { 364 $this->make_user_by_role( 'author' ); 365 $date_string = '1984-01-11 05:00:00'; 366 $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ) ); 367 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 368 $fetched_post = get_post( $result ); 369 $this->assertStringMatchesFormat( '%d', $result ); 370 $this->assertEquals( $date_string , $fetched_post->post_date ); 371 } 372 373 /** 374 * @ticket 28601 375 */ 376 function test_valid_IXR_post_date_gmt() { 377 $this->make_user_by_role( 'author' ); 378 $date_string = '1984-01-11 05:00:00'; 379 $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ) ); 380 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 381 $fetched_post = get_post( $result ); 382 $this->assertStringMatchesFormat( '%d', $result ); 383 $this->assertEquals( $date_string , $fetched_post->post_date_gmt ); 384 } 385 360 386 }
Note: See TracChangeset
for help on using the changeset viewer.