[wp-trac] [WordPress Trac] #48623: WP 5.3 time problem causes day number shifts in permalinks

WordPress Trac noreply at wordpress.org
Thu Nov 14 17:42:38 UTC 2019


#48623: WP 5.3 time problem causes day number shifts in permalinks
--------------------------+---------------------
 Reporter:  steevithak    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.3.1
Component:  Date/Time     |     Version:  5.3
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------

Comment (by steevithak):

 I've been browsing the code repo and I'm betting the bug is caused by a
 change in link-template.php. In 5.2 and older versions you generated the
 permalinks using date(), which renders the permalink in the user's local
 time zone but starting in 5.3 you're using gmdate(), which seems wrong as
 it renders the link in UTC, which in my case means the permalinks are 6
 hours off from where the post actually is, and occasionally slips a day
 boundary. This causes any link created with get_permalink($post->ID) to
 potentially be wrong if the time zones differ (and assuming the post was
 originally created on the non-broken older version and at a time close
 enough to midnight in that time zone to trigger the bug after the
 upgrade).

 Line 215 of
 https://core.trac.wordpress.org/browser/branches/5.3/src/wp-includes/link-
 template.php

 $date           = explode( ' ', gmdate( 'Y m d H i s', $unixtime ) );

 vs

 Line 215
 https://core.trac.wordpress.org/browser/branches/5.2/src/wp-includes/link-
 template.php

 $date           = explode( ' ', date( 'Y m d H i s', $unixtime ) );

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


More information about the wp-trac mailing list