[wp-trac] [WordPress Trac] #35053: XML-RPC when post with date_created_gmt, its post_date will gmt date not local date

WordPress Trac noreply at wordpress.org
Sat Jan 2 08:02:28 UTC 2016


#35053: XML-RPC when post with date_created_gmt, its post_date will gmt date not
local date
------------------------------------------+-----------------------------
 Reporter:  hnle                          |       Owner:  wonderboymusic
     Type:  defect (bug)                  |      Status:  assigned
 Priority:  normal                        |   Milestone:  4.4.1
Component:  XML-RPC                       |     Version:  4.4
 Severity:  normal                        |  Resolution:
 Keywords:  has-unit-tests needs-testing  |     Focuses:
------------------------------------------+-----------------------------

Comment (by dossy):

 Replying to [comment:20 smerriman]:
 [...]
 > With the current approach if post_date is used, it is consistent and
 correct when a local time is passed to post_date, and buggy if you try to
 pass things in another timezone format (as per redsweater's comment).
 [...]

 And, the patch I provided fixes this, as @redsweater confirmed.

 Replying to [comment:19 dd32]:
 > [...] Is there any good reason why this should be pushed into 4.4.1 in
 preference to a revert of behaviour to pre-4.4? The behaviour previous was
 well known as buggy, but consistent, this has simply changed it to be
 buggy in a different way.

 AFAICT, the patch I submitted implements the correct behavior in all cases
 currently described.  If I missed a case, describe it and I'll work on
 implementing the test for it.  I don't agree that it's "simply changed ...
 to b buggy in different way."  The key improvement that I implemented in
 `iso8601_to_datetime()` is to properly use the PHP Date/Time functions to
 coerce the date either to GMT or to local timezone (per `get_option(
 'timezone_string ')`'s setting).

 My implementation might even coincidentally fix #25399, but I'm not
 completely sure since there's no tests that document exactly what the
 breakage is.  I'll read #20328 more carefully and try to decipher exactly
 what @nacin might be referring to as still broken.  It looks like the code
 all uses the old `get_date_from_gmt()` and `get_gmt_from_date()` functions
 and could probably benefit from the changes in `iso8601_to_datetime()` ...

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


More information about the wp-trac mailing list