mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Date/Time: Replace all instances of date() with gmdate().
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed). `gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs. Props nielsdeblaauw, Rarst. Fixes #46438. See #44491. git-svn-id: https://develop.svn.wordpress.org/trunk@45424 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -924,10 +924,10 @@ function rest_get_date_with_gmt( $date, $is_utc = false ) {
|
||||
// Timezone conversion needs to be handled differently between these two
|
||||
// cases.
|
||||
if ( ! $is_utc && ! $has_timezone ) {
|
||||
$local = date( 'Y-m-d H:i:s', $date );
|
||||
$local = gmdate( 'Y-m-d H:i:s', $date );
|
||||
$utc = get_gmt_from_date( $local );
|
||||
} else {
|
||||
$utc = date( 'Y-m-d H:i:s', $date );
|
||||
$utc = gmdate( 'Y-m-d H:i:s', $date );
|
||||
$local = get_date_from_gmt( $utc );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user