mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-05 07:58:35 +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">
|
<p class="timezone-info">
|
||||||
<span>
|
<span>
|
||||||
<?php
|
<?php
|
||||||
// Set TZ so localtime works.
|
$now = new DateTime( 'now', new DateTimeZone( $tzstring ) );
|
||||||
date_default_timezone_set( $tzstring );
|
$dst = (bool) $now->format( 'I' );
|
||||||
$now = localtime( time(), true );
|
|
||||||
if ( $now['tm_isdst'] ) {
|
if ( $dst ) {
|
||||||
_e( 'This timezone is currently in daylight saving time.' );
|
_e( 'This timezone is currently in daylight saving time.' );
|
||||||
} else {
|
} else {
|
||||||
_e( 'This timezone is currently in standard time.' );
|
_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.' );
|
_e( 'This timezone does not observe daylight saving time.' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set back to UTC.
|
|
||||||
date_default_timezone_set( 'UTC' );
|
|
||||||
?>
|
?>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user