Make WordPress Core


Ignore:
Timestamp:
06/26/2014 05:42:17 PM (12 years ago)
Author:
SergeyBiryukov
Message:

XML-RPC: Make sure wp.newPost does not produce a fatal error when a post_date field is included in the data.

props dllh.
fixes #28601.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r28849 r28854  
    11031103                        return $this->error;
    11041104
     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
    11051120                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    11061121                do_action( 'xmlrpc_call', 'wp.newPost' );
Note: See TracChangeset for help on using the changeset viewer.