[wp-trac] [WordPress Trac] #48935: Remove strtotime() usage from core

WordPress Trac noreply at wordpress.org
Wed Dec 11 12:58:07 UTC 2019


#48935: Remove strtotime() usage from core
-------------------------+------------------------------------------
 Reporter:  Rarst        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Date/Time    |    Version:
 Severity:  normal       |   Keywords:  needs-unit-tests needs-patch
  Focuses:               |
-------------------------+------------------------------------------
 `strtotime()` is routinely used in core for processing timezone-ambiguous
 input. Since it is affected by default PHP time zone setting (set by core
 to UTC on boot) it is also vulnerable to this setting being changed by
 third party code.

 Related change of `date()` to `gmdate()` in 5.3 release caused some new
 issues, because in some places while changing default time zone broke
 things combination of `strtotime()` and `date()` meant things got broken
 ''by the same amount'' and outputs were "correct" (ignoring the fact they
 would be implied in absolutely different time zone from intended).

 Dropping use of `strtotime()` in favor of date parsing with explicit time
 zone handling (such as `DateTimeImmutable` objects) is logical next step
 to make core insensitive to PHP time zone context.

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


More information about the wp-trac mailing list