Make WordPress Core

Changeset 46865

Timestamp:
12/09/2019 08:06:37 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.
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']     = );
     1473            $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, '' );
    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( );
     3766            $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, '' );
    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     = );
     5485            $post_date_gmt = iso8601_to_datetime( $dateCreated, '' );
    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     = );
     5874            $post_date_gmt = iso8601_to_datetime( $dateCreated, '' );
    58755875
    58765876            // Flag the post date to be edited.
Note: See TracChangeset for help on using the changeset viewer.