[wp-trac] [WordPress Trac] #30429: wp.newPost gets non-GMT date calculation wrong

WordPress Trac noreply at wordpress.org
Thu Dec 4 20:34:09 UTC 2014


#30429: wp.newPost gets non-GMT date calculation wrong
-------------------------------------------------+-------------------------
 Reporter:  smerriman                            |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  XML-RPC                              |  Review
 Severity:  normal                               |     Version:  3.4
 Keywords:  has-patch needs-testing needs-unit-  |  Resolution:
  tests                                          |     Focuses:
-------------------------------------------------+-------------------------
Changes (by smerriman):

 * keywords:  has-patch needs-testing reporter-feedback needs-unit-tests =>
     has-patch needs-testing needs-unit-tests


Comment:

 Sure. As a specific example, set the Wordpress timezone to
 Pacific/Auckland (currently GMT+13), and run the following code from the
 root dir (altering domain/user/pass as appropriate):

 {{{
 <?php
 include('./wp-load.php');

 include_once( ABSPATH . WPINC . '/class-IXR.php' );
 include_once( ABSPATH . WPINC . '/class-wp-http-ixr-client.php' );

 $client = new WP_HTTP_IXR_CLIENT( 'http://www.domain.com/xmlrpc.php' );

 $content = array(
         'post_type'=>'post',
         'post_title'=>'Test post',
         'post_status'=>'publish',
         'post_author'=>1,
         'post_date'=>'2014-12-01 12:00:00'
 );

 $client->query('wp.newPost','','username','password',$content,true);
 }}}

 The resulting dates in the database will be:

 post_date_gmt: 2014-11-30 23:00:00 (correct)
 post_date: 2014-12-02 01:00:00 (13 hours later than it should be)

 Not experienced enough with organising unit tests myself yet sorry!sorry!

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


More information about the wp-trac mailing list