[wp-trac] [WordPress Trac] #48936: Remove mysql2date() usage from core

WordPress Trac noreply at wordpress.org
Wed Dec 11 13:04:27 UTC 2019


#48936: Remove mysql2date() usage from core
--------------------------+------------------------------------------
 Reporter:  Rarst         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Date/Time     |    Version:
 Severity:  normal        |   Keywords:  needs-patch needs-unit-tests
  Focuses:                |
--------------------------+------------------------------------------
 `mysql2date()` was originally meant from processing times as stored by WP
 in database.

 Unfortunately its design is very limited because both time zone of input
 and output is ambiguous. It is interchangeably used for local and UTC
 times.

 As implementation detail that meant that it would produce incorrect output
 for formats including time zones for local time inputs. Time zone would
 happen be UTC from WP core setting PHP time zone to UTC on load.

 In 5.3 release this behavior was flipped to produce correct local time
 output for local time input, as considerably more common. Accordingly now
 ''UTC'' input produces incorrect output for formats with time zone.

 While the function is common and familiar, it is hardly irreplaceable and
 its design is so limited it seems to be unsalvageable.

 I propose we move towards eliminating its use in core and eventually
 formally deprecating it.

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


More information about the wp-trac mailing list