diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000..1f7391f --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000..e6abc56 --- /dev/null +++ b/.topmsg @@ -0,0 +1,7 @@ +From: leiww +Subject: [PATCH] t/fix_timezone_reset_bug + +当时区设置为不同格式,如数字:+8,或者时区名:Asia/Shanghai 时,PHP 脚本得到的时区可能不一致,被意外重置! +例如会导致:意外重置时区设置,导致评论时间显示为负数。 + +Signed-off-by: leiww diff --git a/wp-includes/functions.php b/wp-includes/functions.php index c4a481b..8afe22e 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3321,7 +3321,10 @@ function wp_timezone_override_offset() { return false; } - @date_default_timezone_set( $timezone_string ); + // Warning: Do not reset timezone here, timezone offset can be provided in eithor + // gmt_offset, or timezone_string. Reset here will cause trouble. + // -- ossxp.com + // @date_default_timezone_set( $timezone_string ); $timezone_object = timezone_open( $timezone_string ); $datetime_object = date_create(); if ( false === $timezone_object || false === $datetime_object ) {