Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#39018 closed defect (bug) (worksforme)

gmt_offset is not set when timezone strings are used

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

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
10 years ago

  • Resolution → worksforme
  • Status new → 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
10 years ago

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