Changeset 28854
- Timestamp:
- 06/26/2014 05:42:17 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r28849 r28854 1103 1103 return $this->error; 1104 1104 1105 // convert the date field back to IXR form 1106 if ( isset( $content_struct['post_date'] ) ) { 1107 $content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] ); 1108 } 1109 1110 // ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct, 1111 // since _insert_post will ignore the non-GMT date if the GMT date is set 1112 if ( isset( $content_struct['post_date_gmt'] ) ) { 1113 if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) { 1114 unset( $content_struct['post_date_gmt'] ); 1115 } else { 1116 $content_struct['post_date_gmt'] = $this->_convert_date( $content_struct['post_date_gmt'] ); 1117 } 1118 } 1119 1105 1120 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 1106 1121 do_action( 'xmlrpc_call', 'wp.newPost' ); -
trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
r25002 r28854 306 306 } 307 307 308 /** 309 * @ticket 28601 310 */ 311 function test_invalid_post_date_does_not_fatal() { 312 $this->make_user_by_role( 'author' ); 313 $date_string = '2014-01-01 10:10:10'; 314 $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string ); 315 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 316 $fetched_post = get_post( $result ); 317 $this->assertStringMatchesFormat( '%d', $result ); 318 } 319 320 /** 321 * @ticket 28601 322 */ 323 function test_invalid_post_date_gmt_does_not_fatal() { 324 $this->make_user_by_role( 'author' ); 325 $date_string = 'invalid date'; 326 $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => $date_string ); 327 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 328 $fetched_post = get_post( $result ); 329 $this->assertStringMatchesFormat( '%d', $result ); 330 } 331 308 332 }
Note: See TracChangeset
for help on using the changeset viewer.