From 49692206c00e17a007e855b433ef9771184c8bc1 Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Fri, 10 Mar 2023 15:36:20 +0000 Subject: [PATCH] Date/Time: Save a call to wp_timezone in mysql2date. Save a call to wp_timezone in mysql2date by saving the timezone to a variable and pass it into wp_date function call. Props spacedmonkey, costdev, SergeyBiryukov, audrasjb. Fixes #57705. Built from https://develop.svn.wordpress.org/trunk@55514 git-svn-id: http://core.svn.wordpress.org/trunk@55046 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 5 +++-- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 3183739378..fca19a32d5 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -32,7 +32,8 @@ function mysql2date( $format, $date, $translate = true ) { return false; } - $datetime = date_create( $date, wp_timezone() ); + $timezone = wp_timezone(); + $datetime = date_create( $date, $timezone ); if ( false === $datetime ) { return false; @@ -44,7 +45,7 @@ function mysql2date( $format, $date, $translate = true ) { } if ( $translate ) { - return wp_date( $format, $datetime->getTimestamp() ); + return wp_date( $format, $datetime->getTimestamp(), $timezone ); } return $datetime->format( $format ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 2c60ba15c3..e815bf3e87 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55513'; +$wp_version = '6.3-alpha-55514'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.