[wp-trac] [WordPress Trac] #48675: mysql2date adding timezone offset when given GMT time

WordPress Trac noreply at wordpress.org
Sun Nov 17 07:37:36 UTC 2019


#48675: mysql2date adding timezone offset when given GMT time
--------------------------+---------------------
 Reporter:  lisota        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.3.1
Component:  Date/Time     |     Version:  5.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------

Comment (by Rarst):

 So `mysql2date()` is a horribly designed and implemented function, that
 worked primarily with local times, but treated them as UTC times and
 pretended that it makes sense, as long as you don't output the time zone.

 Of course as soon as you output time zone, turns out that entirety of your
 local time handling is horribly broken.

 What do you do when you ''do'' need correct time zone? Do you fix the
 code? No, obviously you just pass the UTC time to a function that is
 mostly used for local times and broken for them, but happens to work
 correctly for UTC because that is what it's actually doing instead of what
 it is used for most of the time.

 So on implementation level I flipped this assumption. Now the function
 works correctly for all the local time inputs, but apparently not for UTC
 time inputs.

 This was one of those places where bugfix cannot be separated from a
 change in behavior.

 In my opinion this fixes more than it breaks?..

 So the ''obvious'' strategic action is to get rid of this function
 entirely, and I've been eagerly cutting its use from core.

 But since we still must keep it around (ugh) the question is what to do
 with implementation.

 Choices are:
 1. Keep the bug fix, keep the behavior change, document ''UTC input''
 problem.
 2. Revert the behavior change, lose the bug fix, document ''local input''
 problem.

 Regardless of implementation choice burn its use out of core with fire.

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


More information about the wp-trac mailing list