[wp-trac] [WordPress Trac] #39595: date_default_timezone_set in wp-settings.php is set prematurely and ignorantly, regardless of other defined settings

WordPress Trac noreply at wordpress.org
Mon Jan 16 02:05:07 UTC 2017


#39595: date_default_timezone_set in wp-settings.php is set prematurely and
ignorantly, regardless of other defined settings
-------------------------------+------------------------------
 Reporter:  mkormendy          |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Date/Time          |     Version:  4.7.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by dd32):

 > But I'm also noticing that some plugins (major players: gravity forms,
 yoast seo, contact form DB) also don't store or report times correctly
 either because they expect the default PHP timezone to be either what is
 in php.ini -OR- what is stored in the WP Admin General Settings
 (wp_options: gmt_offset and timezone_string).

 I'm going to assume that these are probably more likely caused by
 expecting the DB time returned by `NOW()` or as the default for date
 fields to be a UTC timestamp - unless you're experiencing that when you
 remove the `date_default_timezone_set( 'UTC' );` call in which case yes,
 that would probably be the expected outcome of attempting to use `date()`
 functions.
 MySQL doesn't store the timezone information with timestamps, so having
 `NOW()` return a non-UTC timestamp is very confusing for an application.

 > I have come across a slew of client servers (shared hosting, etc) where
 a reasonable amount of WP-based websites might not have a choice if the
 server is set to the local timezone for logging purposes and not UTC.

 I fail to see what the problem is here if an application chooses to base
 it's timezone on UTC here. You can set the logging to anything  - the fact
 that PHP logs respect the timezone the application chooses is odd, but
 IMHO not the applications problem.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39595#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list