From d13ce45ff67f5aa2946a6fc5c0b424ad20b51afa Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 21 Nov 2019 13:18:00 +0000 Subject: [PATCH] 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. Fixes #48675. Built from https://develop.svn.wordpress.org/trunk@46756 git-svn-id: http://core.svn.wordpress.org/trunk@46556 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/feed.php | 8 +++++++- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/feed.php b/wp-includes/feed.php index 95e81d8eaf..88f7af44f8 100644 --- a/wp-includes/feed.php +++ b/wp-includes/feed.php @@ -682,7 +682,13 @@ function get_feed_build_date( $format ) { } // Determine the maximum modified time. - $max_modified_time = mysql2date( $format, max( $modified_times ), false ); + $datetime = date_create_immutable_from_format( + 'Y-m-d h:i:s', + max( $modified_times ), + new DateTimeZone( 'UTC' ) + ); + + $max_modified_time = $datetime->format( $format ); /** * Filters the date the last post or comment in the query was modified. diff --git a/wp-includes/version.php b/wp-includes/version.php index aaf5f39028..474d7f79af 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46755'; +$wp_version = '5.4-alpha-46756'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.