Make WordPress Core

Opened 3 weeks ago

#44491 new enhancement

Date/time calculations should not depend on default UTC time zone

Reported by: Rarst Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Date/Time Keywords:
Focuses: Cc:


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.

Change History (0)

Note: See TracTickets for help on using tickets.