Make WordPress Core

Changeset 46864

Timestamp:
12/09/2019 07:54:16 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Date/Time: XML-RPC: Сalculate the proper offset for GMT in wp.newPost, wp.editComment, mw.newPost, mw.editPost when post_date or comment_date is set.

Previously, post_date or comment_date was assumed to be GMT, which is only true if the timezone string for the site matches GMT.

Add unit tests.

Props Rarst, smerriman, justdaiv, wonderboymusic, noyle.
Fixes #30429.

Location:
trunk
Files:
1 added
1 edited

Legend:

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

    r46814 r46864  
    14701470
    14711471        if ( ! empty( $dateCreated ) ) {
    1472             $post_data['post_date']     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    1473             $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
     1472            $post_data['post_date']     = );
     1473            $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, '' );
    14741474
    14751475            // Flag the post date to be edited.
    ��  
    37673767            // We know this is supposed to be GMT, so we're going to slap that Z on there by force
    37683768            $dateCreated                 = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
    3769             $comment['comment_date']     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    3770             $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
     3769            $comment['comment_date']     = get_date_from_gmt( );
     3770            $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, '' );
    37713771        }
    37723772
     
    54865486
    54875487        if ( ! empty( $dateCreated ) ) {
    5488             $post_date     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    5489             $post_date_gmt = iso8601_to_datetime( $dateCreated, 'GMT' );
     5488            $post_date     = );
     5489            $post_date_gmt = iso8601_to_datetime( $dateCreated, '' );
    54905490        } else {
    54915491            $post_date     = '';
     
    58755875
    58765876        if ( ! empty( $dateCreated ) ) {
    5877             $post_date     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    5878             $post_date_gmt = iso8601_to_datetime( $dateCreated, 'GMT' );
     5877            $post_date     = );
     5878            $post_date_gmt = iso8601_to_datetime( $dateCreated, '' );
    58795879
    58805880            // Flag the post date to be edited.
Note: See TracChangeset for help on using the changeset viewer.