[wp-trac] [WordPress Trac] #48384: get_post_time returns wrong value after timezone switch

WordPress Trac noreply at wordpress.org
Wed Oct 23 07:57:12 UTC 2019


#48384: get_post_time returns wrong value after timezone switch
-------------------------------------------------+-------------------------
 Reporter:  david.binda                          |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  5.3
Component:  Date/Time                            |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  dev-feedback                                   |
-------------------------------------------------+-------------------------

Comment (by Rarst):

 Ok, so there are two issues:

 1. GMT slipping with time zone change, fixed by standing patch
 2. `column_date()` logic behaving differently because `get_post_time()`
 failure mode changed in new code from internal implementation changes

 Looking at 5.2 `get_post_time()` actually returns ''gibberish negative
 number value'' for drafts (probably a negative timestamp for "year zero"
 time or something like that). So anything producing meaningful result
 there is pretty much implementation accident, the logic is long broken.

 So I suggest:
 1. We proceed with the standing patch, since it fixes clear testable
 regression (and unfortunately forces our hand to have to choose how to
 instantiate objects for backwards compat)
 2. Stuff a check for valid `get_post_time()` return in the `column_date()`
 and skip the relative time branch, since we can't calculate it with bogus
 input

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


More information about the wp-trac mailing list