[wp-trac] [WordPress Trac] #44491: Date/time calculations should not depend on default UTC time zone

WordPress Trac noreply at wordpress.org
Mon Jul 2 17:13:26 UTC 2018


#44491: Date/time calculations should not depend on default UTC time zone
-------------------------+-----------------------------
 Reporter:  Rarst        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Date/Time    |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 At the moment WP explicitly sets default PHP time zone to UTC during core
 load. A lot of calculations in core depend on that being the case when
 they execute.

 Unfortunately as a runtime setting this can be easily changed by
 extensions, and there are plenty out there that mess it up.

 While we cannot stop setting time zone to UTC (which would be giant
 backwards compatibility break) we can and ''should'' make all calculations
 in core independent of this context.

 Specific things that should be fixed or audited:

 - no `date()` calls, only `gmdate()`;
 - no `strtotime()` calls on input with ambiguous time zone;
 - no `DateTime` instancing without explicit time zone.

 Will work on a patch.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44491>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list