[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
Fri Dec 6 09:28:18 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 | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by noyle):
Yep. I've checked by adding following script in current theme, the page
does displays `UTC`:
{{{
<div>
<?php echo date_default_timezone_get(); ?>
</div>
}}}
Looks like the result here is the same in #30429 . However, I've also
tested it with 5.2.4, there's no such issue. Both tests are in new
installations of 5.3 & 5.2.4 on PHP 7.3 (`date.timezone` is set to
Asia/Hong_Kong, actually leaving it blank did the same result) / Windows
10 (timezone in UTC+8). My own online wp install on a server running PHP
7.0 ubuntu 16.04 also has this defect (massively tested).
Here's the result on 5.2.4:
Set the timezone setting in WordPress as UTC-11. 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`
"15" "1" "2019-12-05 22:10:59" "2019-12-06 09:10:59" ""
"UTC-11 from web" "" "publish" "open" "open" ""
"utc-11-from-web" "" "" "2019-12-05 22:10:59"
"2019-12-06 09:10:59" "" "0"
"http://wordpress-52.mydev.test/?p=15" "0" "post" "" "0"
"16" "1" "2019-12-05 22:10:59" "2019-12-06 09:10:59" ""
"UTC-11 from web" "" "inherit" "closed" "closed"
"" "15-revision-v1" "" "" "2019-12-05 22:10:59"
"2019-12-06 09:10:59" "" "15"
"http://wordpress-52.mydev.test/2019/12/05/15-revision-v1/" "0"
"revision" "" "0"
"17" "1" "2019-12-05 22:11:22" "2019-12-06 09:11:22" ""
"utc-11 from wp Android" "" "publish" "open" "open" ""
"utc-11-from-wp-android" "" "" "2019-12-05 22:11:28"
"2019-12-06 09:11:28" "" "0"
"http://wordpress-52.mydev.test/?p=17" "0" "post" "" "0"
"18" "1" "2019-12-05 22:11:28" "2019-12-06 09:11:28" ""
"utc-11 from wp Android" "" "inherit" "closed"
"closed" "" "17-revision-v1" "" ""
"2019-12-05 22:11:28" "2019-12-06 09:11:28" "" "17"
"http://wordpress-52.mydev.test/2019/12/05/17-revision-v1/" "0"
"revision" "" "0"
}}}
You'll see the post_data of ID=17 (published one) is the right timezone-
respected time.
Now set the timezone setting in WordPress as UTC+4:
{{{
`ID` `post_author` `post_date` `post_date_gmt` `post_content`
`post_title`
"19" "1" "2019-12-06 13:13:59" "2019-12-06 09:13:59" ""
"UTC+4 from web" "" "publish" "open" "open" ""
"utc4-from-web" "" "" "2019-12-06 13:13:59" "2019-12-06
09:13:59" "" "0" "http://wordpress-52.mydev.test/?p=19" "0"
"post" "" "0"
"20" "1" "2019-12-06 13:13:59" "2019-12-06 09:13:59" ""
"UTC+4 from web" "" "inherit" "closed" "closed"
"" "19-revision-v1" "" "" "2019-12-06 13:13:59"
"2019-12-06 09:13:59" "" "19"
"http://wordpress-52.mydev.test/2019/12/06/19-revision-v1/" "0"
"revision" "" "0"
"21" "1" "2019-12-06 13:14:18" "2019-12-06 09:14:18" ""
"utc+4 from wp Android" "" "publish" "open" "open" ""
"utc4-from-wp-android" "" "" "2019-12-06 13:14:20"
"2019-12-06 09:14:20" "" "0"
"http://wordpress-52.mydev.test/?p=21" "0" "post" "" "0"
"22" "1" "2019-12-06 13:14:20" "2019-12-06 09:14:20" ""
"utc+4 from wp Android" "" "inherit" "closed" "closed"
"" "21-revision-v1" "" "" "2019-12-06 13:14:20"
"2019-12-06 09:14:20" "" "21"
"http://wordpress-52.mydev.test/2019/12/06/21-revision-v1/" "0"
"revision" "" "0"
}}}
You'll see the post_data of ID=21 (published one) is the right timezone-
respected time.
The request body (password replaced by ...) of the second post (with UTC+4
timezone):
{{{
<?xml version='1.0'
?><methodCall><methodName>wp.newPost</methodName><params><param><value><string>1</string></value></param><param><value><string>admin</string></value></param><param><value><string>...</string></value></param><param><value><struct><member><name>post_title</name><value><string>utc+4
from wp
Android</string></value></member><member><name>post_content</name><value><string></string></value></member><member><name>post_date</name><value><dateTime.iso8601>20191206T09:14:18</dateTime.iso8601></value></member><member><name>post_password</name><value><string></string></value></member><member><name>post_thumbnail</name><value><string>0</string></value></member><member><name>post_format</name><value><string>standard</string></value></member><member><name>post_type</name><value><string>post</string></value></member><member><name>post_status</name><value><string>publish</string></value></member><member><name>post_excerpt</name><value><string></string></value></member><member><name>comment_status</name><value><string>open</string></value></member><member><name>post_date_gmt</name><value><dateTime.iso8601>20191206T09:14:18</dateTime.iso8601></value></member></struct></value></param></params></methodCall>
}}}
The output of `date_default_timezone_get()` in 5.2.4 is also `UTC`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48886#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list