mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-31 13:37:51 +01:00
Date/Time: Eliminate use of date_default_timezone_set()
for determining DST status on General Options screen.
Time calculations should not need to rely on manipulating global PHP configuration state. Props Rarst. Fixes #46483. Built from https://develop.svn.wordpress.org/trunk@45556 git-svn-id: http://core.svn.wordpress.org/trunk@45367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a06e914bae
commit
89e7a75d96
@ -252,10 +252,10 @@ if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists
|
||||
<p class="timezone-info">
|
||||
<span>
|
||||
<?php
|
||||
// Set TZ so localtime works.
|
||||
date_default_timezone_set( $tzstring );
|
||||
$now = localtime( time(), true );
|
||||
if ( $now['tm_isdst'] ) {
|
||||
$now = new DateTime( 'now', new DateTimeZone( $tzstring ) );
|
||||
$dst = (bool) $now->format( 'I' );
|
||||
|
||||
if ( $dst ) {
|
||||
_e( 'This timezone is currently in daylight saving time.' );
|
||||
} else {
|
||||
_e( 'This timezone is currently in standard time.' );
|
||||
@ -296,8 +296,6 @@ if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists
|
||||
_e( 'This timezone does not observe daylight saving time.' );
|
||||
}
|
||||
}
|
||||
// Set back to UTC.
|
||||
date_default_timezone_set( 'UTC' );
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-45555';
|
||||
$wp_version = '5.3-alpha-45556';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user