Date/Time: Make sure `current_time()` always calculates the offset from GMT/UTC.

Previously, UTC context was implied, but could be unreliable due to being affected by plugins.

Props Rarst, rahulsprajapati, marco.marsala.
Fixes #37440.
Built from https://develop.svn.wordpress.org/trunk@43594


git-svn-id: http://core.svn.wordpress.org/trunk@43423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-08-30 12:13:24 +00:00
parent 07e2fba981
commit 998d381fa0
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ function current_time( $type, $gmt = 0 ) {
case 'timestamp':
return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
default:
return ( $gmt ) ? date( $type ) : date( $type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
return ( $gmt ) ? gmdate( $type ) : gmdate( $type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-43593';
$wp_version = '5.0-alpha-43594';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.