[wp-trac] [WordPress Trac] #48886: Posting via XMLRPC (eg. WordPress Android App) causes post_date to have a doubled substitution by timezone

WordPress Trac noreply at wordpress.org
Thu Dec 5 17:13:22 UTC 2019


#48886: Posting via XMLRPC (eg. WordPress Android App) causes post_date to have a
doubled substitution by timezone
--------------------------+-----------------------------
 Reporter:  noyle         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Date/Time     |    Version:  5.3
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Although the title says XMLRPC, I think the real defect is in other
 components.

 The the following is only observed when posting a post from using a latest
 WordPress Android App ([https://apps.wordpress.com/mobile/]), i.e., from
 XMLRPC. There's no such issue to post from WordPress's own web interface.

 I only tried the Android one, but I think the problem is in WordPress not
 the App. I use NGINX to capture what the App POST and will post the
 request body in a separated comment.

 Set the timezone setting in WordPress as UTC-6. Make a post from web
 interface and then via XMLRPC (from WordPress Android App), the database
 contains 4 records of posts:
 {{{
 `ID`    `post_author`   `post_date`     `post_date_gmt` `post_content`
 `post_title`
 "41"    "1"     "2019-12-05 11:02:10"   "2019-12-05 17:02:10"   "<!--
 wp:paragraph --><p>From web interface.</p><!-- /wp:paragraph -->" "hello"
 ""      "publish"       "open"  "open"  ""      "hello-2"       ""      ""
 "2019-12-05 11:02:10"   "2019-12-05 17:02:10"   ""      "0"
 "http://mydev.test/?p=41"       "0"     "post"  ""      "0"
 "42"    "1"     "2019-12-05 11:02:10"   "2019-12-05 17:02:10"   "<!--
 wp:paragraph --><p>From web interface.</p><!-- /wp:paragraph -->" "hello"
 ""      "inherit"       "closed"        "closed"        ""
 "41-revision-v1"        ""      ""      "2019-12-05 11:02:10"
 "2019-12-05 17:02:10"   ""      "41"
 "http://mydev.test/2019/12/05/1102/41-revision-v1/"     "0"     "revision"
 ""      "0"
 "43"    "1"     "2019-12-05 05:03:11"   "2019-12-05 17:03:11"   "From
 WordPress Android App."   "hello" ""      "publish"       "open"  "open"
 ""      "hello-3"       ""      ""      "2019-12-05 11:03:13"
 "2019-12-05 17:03:13"   ""      "0"     "http://mydev.test/?p=43"
 "0"     "post"  ""      "0"
 "44"    "1"     "2019-12-05 11:03:13"   "2019-12-05 17:03:13"   "From
 WordPress Android App."   "hello" ""      "inherit"       "closed"
 "closed"        ""      "43-revision-v1"        ""      ""
 "2019-12-05 11:03:13"   "2019-12-05 17:03:13"   ""      "43"
 "http://mydev.test/2019/12/05/1103/43-revision-v1/"     "0"     "revision"
 ""      "0"
 "0"
 }}}

 You'll see the post_data of ID=43 (published one) is **2 x -6** from GMT
 time.

 Now set the timezone setting in WordPress as UTC+9:
 {{{
 `ID`    `post_author`   `post_date`     `post_date_gmt` `post_content`
 `post_title`
 "45"    "1"     "2019-12-06 02:06:41"   "2019-12-05 17:06:41"   "<!--
 wp:paragraph --><p>From Web.</p><!-- /wp:paragraph -->"   "now +9"
 ""      "publish"       "open"  "open"  ""      "now-9" ""      ""
 "2019-12-06 02:06:41"   "2019-12-05 17:06:41"   ""      "0"
 "http://mydev.test/?p=45"       "0"     "post"  ""      "0"
 "46"    "1"     "2019-12-06 02:06:41"   "2019-12-05 17:06:41"   "<!--
 wp:paragraph --><p>From Web.</p><!-- /wp:paragraph -->"   "now +9"
 ""      "inherit"       "closed"        "closed"        ""
 "45-revision-v1"        ""      ""      "2019-12-06 02:06:41"
 "2019-12-05 17:06:41"   ""      "45"
 "http://mydev.test/2019/12/06/0206/45-revision-v1/"     "0"     "revision"
 ""      "0"
 "47"    "1"     "2019-12-06 11:06:58"   "2019-12-05 17:06:58"   "From
 App."     "Now +9"        ""      "publish"       "open"  "open"  ""
 "now-9-2"       ""      ""      "2019-12-06 02:06:59"   "2019-12-05
 17:06:59"   ""      "0"     "http://mydev.test/?p=47"       "0"     "post"
 ""      "0"
 "48"    "1"     "2019-12-06 02:06:59"   "2019-12-05 17:06:59"   "From
 App."     "Now +9"        ""      "inherit"       "closed"        "closed"
 ""      "47-revision-v1"        ""      ""      "2019-12-06 02:06:59"
 "2019-12-05 17:06:59"   ""      "47"
 "http://mydev.test/2019/12/06/0206/47-revision-v1/"     "0"     "revision"
 ""      "0"

 }}}
 You'll see the post_data of ID=47 (published one) is **2 x +9** from GMT
 time.


 There's no such issue when I'm using WordPress 5.2, and also have tested
 above steps in v5.2.4. I don't know where the problem actually lies. I've
 compared the code from 5.3 with 5.2.4, XMLRPC looks no major changes. What
 I found is that the way of determining $post_status is changed. But I'm
 not sure it's the real culprit.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48886>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list