WordPress.org

Make WordPress Core

Changeset 46865 for branches/5.3


Ignore:
Timestamp:
12/09/2019 08:06:37 PM (23 months 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.
Merges [46864] to the 5.3 branch.
Fixes #30429.

Location:
branches/5.3
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/class-wp-xmlrpc-server.php

    r46232 r46865  
    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']     = iso8601_to_datetime( $dateCreated );
     1473            $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' );
    14741474
    14751475            // Flag the post date to be edited.
     
    37633763            // We know this is supposed to be GMT, so we're going to slap that Z on there by force
    37643764            $dateCreated                 = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
    3765             $comment['comment_date']     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    3766             $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
     3765            $comment['comment_date']     = get_date_from_gmt( $dateCreated );
     3766            $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' );
    37673767        }
    37683768
     
    54825482
    54835483        if ( ! empty( $dateCreated ) ) {
    5484             $post_date     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    5485             $post_date_gmt = iso8601_to_datetime( $dateCreated, 'GMT' );
     5484            $post_date     = iso8601_to_datetime( $dateCreated );
     5485            $post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' );
    54865486        } else {
    54875487            $post_date     = '';
     
    58715871
    58725872        if ( ! empty( $dateCreated ) ) {
    5873             $post_date     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    5874             $post_date_gmt = iso8601_to_datetime( $dateCreated, 'GMT' );
     5873            $post_date     = iso8601_to_datetime( $dateCreated );
     5874            $post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' );
    58755875
    58765876            // Flag the post date to be edited.
Note: See TracChangeset for help on using the changeset viewer.