Make WordPress Core


Ignore:
Timestamp:
11/25/2019 10:10:31 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Date/Time: Remove mysql2date() usage in get_feed_build_date() to ensure the output includes correct timezone offset.

With the changes in [45908], mysql2date() works correctly for all local time inputs, but should not be used for UTC time inputs.

Add a unit test.

Props Rarst, lisota.
Merges [46756] and [46757] to the 5.3 branch.
Fixes #48675.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/feed.php

    r45932 r46774  
    684684
    685685        // Determine the maximum modified time.
    686         $max_modified_time = mysql2date( $format, max( $modified_times ), false );
     686        $datetime = date_create_immutable_from_format(
     687                'Y-m-d H:i:s',
     688                max( $modified_times ),
     689                new DateTimeZone( 'UTC' )
     690        );
     691
     692        $max_modified_time = $datetime->format( $format );
    687693
    688694        /**
Note: See TracChangeset for help on using the changeset viewer.