Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#39018 closed defect (bug) (worksforme)

gmt_offset is not set when timezone strings are used

Reported by: jessepearson's profile jessepearson Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: Options, Meta APIs Keywords:
Focuses: administration Cc:

Description

Steps to reproduce

  1. Create a clean install
  2. Go to Settings > General
  3. Change time zone to any string that is not UTC+-
  4. View gmt_offset in wp_options, it will be empty

Notes

This appears to happen here:
https://core.trac.wordpress.org/browser/trunk/src/wp-admin/options.php#L177

If gmt_offset is empty, then current_time always returns UTC time.
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/functions.php#L61

Change History (2)

#1 @jessepearson
9 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Came into this with fresh eyes this morning, it appears that this filter exists:

// Timezone
add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );

This comes into play when get_option( 'gmt_offset' ) is used. It will convert the timezone string into a UTC offset and return it.

#2 @netweb
9 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.