Opened 17 months ago
Closed 14 months ago
#19733 closed defect (bug) (fixed)
XML-RPC returns invalid dates if the date is zero
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | XML-RPC | Version: | 3.3 |
| Severity: | normal | Keywords: | has-patch mobile needs-unit-tests |
| Cc: | ercoli@…, marko@…, max@… |
Description
When a post has a 'pending' status, post_date_gmt is set to 0000-00-00 00:00:00 as a marker to update post_date when it's saved (see #5698).
mysql2date then proceeds to turn that date into a negative one, and IXR_Date destroys the thing a bit more, so 0000-00-00 00:00:00 turns into -0001113TT0::0::00, which is an invalid ISO8601 date
Attachments (6)
Change History (20)
comment:2
daniloercoli — 17 months ago
- Cc ercoli@… added
comment:3
DrewAPicture — 17 months ago
Also, IXR_Date doesn't like "weird" dates.
- mysql2date returns -00011130T00:00:00. It looks weird but it makes sense: 0000-00-00 -> -1-12-00 -> -1-11-30
- IXR_Date works by taking substrings, and the leading '-' is what breaks everything.
Using a NULL for a 'zero' date might make sense, but I wonder how many things would break, probably including XML-RPC :(
comment:6
markoheijnen — 15 months ago
- Cc marko@… added
Added a new patch at #18429 that also fixes this issue. Do need to test it tomorrow if it works as it should.
markoheijnen — 15 months ago
comment:8
markoheijnen — 15 months ago
Added a patch that applies the patch of maxcutler to all the methods. I didn't applied the code of the first patch of this ticket. Is that still needed?
comment:10
westi — 14 months ago
- Keywords needs-unit-tests added
I would really like to have the last patch in 3.4 but I also really don't want to commit it without us adding test cases because I just found a bunch of bugs in the featured image stuff we applied everywhere by writing the basic test cases for mw_(new|edit)_Post.
If someone wants to write up some tests to cover the date stuff that would be really helpful.
markoheijnen — 14 months ago
comment:11
markoheijnen — 14 months ago
I applied the patch of koke in a way that it only applies for incorrect dates. No matter what the post status is.
I also applied it to all the new XML-RPC methods so everything has the same date handling.
A benefit for this patch is that _convert_date and _convert_date_gmt only return an IXR_Date.
markoheijnen — 14 months ago
markoheijnen — 14 months ago
comment:12
westi — 14 months ago
I took a look at the last patch and all looks good apart from:
- _convert_mysql2date is a level of abstraction too far - lets just call mysql2date directly.
- $this-> _convert_date( $date_gmt ); - space in this.
@markoheijnen could you give the patch a refresh to address these?
markoheijnen — 14 months ago
comment:13
markoheijnen — 14 months ago
Fixed that in patch-core-19733-5.diff
comment:14
westi — 14 months ago
- Owner set to westi
- Resolution set to fixed
- Status changed from new to closed
In [20353]:

Added a patch which sets the post_date_gmt value to the converted post_date for pending and auto-draft posts.