[wp-trac] [WordPress Trac] #21987: function get_post_time - if gmt (unset)

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 15 09:26:18 UTC 2012


#21987: function get_post_time -  if gmt  (unset)
-------------------------------------+------------------------------
 Reporter:  soficgr                  |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Date/Time                |     Version:
 Severity:  minor                    |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------------------

Comment (by Whissi):

 Sorry, my approach was wrong.

 WordPress is using the "0000-00-00 00:00:00" value as magic value for "no
 value". If we would set any valid 32-bit value in query.php, functions
 relying on the "no value" value would stop working as expected.

 So the initial problem is, that years ago, someone used "0000-00-00
 00:00:00" as a magic value for null instead of NULL. This was working on
 32-bit systems, because "00-00-00 00:00:00" is an invalid date on 32-bit
 systems (see https://bugs.php.net/bug.php?id=53662). But on 64-bit
 systems, it is now a valid date.

 => A real solution would change the database schema to use NULL instead of
 "0000-00-00 00:00:00".

 I will create another bug for that.

 Unti this get fixed I would recommend:
  * Fork get_post_time() function (this will be easier to maintain)
  * Modify get_post_time() to set post_date_gmt when no value was set and
 you cannot or don't want to fork

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21987#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list