[wp-trac] [WordPress Trac] #34435: get_gmt_from_date() can return incorrect value when input during fall's DST switch

WordPress Trac noreply at wordpress.org
Sun Oct 25 19:16:35 UTC 2015


#34435: get_gmt_from_date() can return incorrect value when input during fall's DST
switch
------------------------------------+-----------------------------
 Reporter:  danielbachhuber         |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Date/Time               |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  needs-patch needs-docs  |     Focuses:
------------------------------------+-----------------------------
Changes (by danielbachhuber):

 * keywords:   => needs-patch needs-docs
 * milestone:  Awaiting Review => Future Release


Comment:

 Doing a search of the codebase, there are a few key places
 `get_gmt_from_date()` is used:

 * `_wp_translate_postdata()`
 [https://core.trac.wordpress.org/browser/tags/4.3/src/wp-
 admin/includes/post.php#L165 ref]
 * `wp_insert_post()` [https://core.trac.wordpress.org/browser/tags/4.3/src
 /wp-includes/post.php#L3292 ref]
 * `wp_insert_comment()`
 [https://core.trac.wordpress.org/browser/tags/4.3/src/wp-
 includes/comment.php#L2183 ref]
 * Throughout `wp_xmlrpc_server`

 I have two practical recommendations:

 * In the `wp_insert_*()` functions, when neither `*_date` nor `*_date_gmt`
 values are passed, `*_date` should be set from `*_date_gmt`
 * Include a concise note in `get_gmt_from_date()`'s PHPdoc mentioning this
 scenario where the function return value is ambiguous.

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


More information about the wp-trac mailing list