#13300 closed defect (bug) (invalid)
class IXR_Date transforms invalid timestamp.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | XML-RPC | Version: | 3.0.1 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: |
Description
class-IXR.php, class IXR_Date, parseIso() line 693 should look like this to solve the problem.
function parseIso($iso) {
$this->year = substr($iso, 0, 4);
$this->month = substr($iso, 5, 2);
$this->day = substr($iso, 8, 2);
$this->hour = substr($iso, 11, 2);
$this->minute = substr($iso, 14, 2);
$this->second = substr($iso, 17, 2);
WP adds timezone. See #2036
$this->timezone = substr($iso, 17);
}
Attachments (2)
Change History (12)
comment:1
josephscott — 3 years ago
Can you provide details on what exactly the problem is? Precise steps on how to reproduce it would be very helpful.
- Keywords reporter-feedback added; IXR_Date XML-RPC removed
- Milestone changed from 2.9.3 to Unassigned
comment:3
mathiasschopmans — 3 years ago
- Keywords has-patch added; reporter-feedback removed
- Resolution set to worksforme
- Status changed from new to closed
- Version changed from 2.9.2 to 3.0
it's pretty hard for me to explain, but i'll try:
- i'm using wordpress to aggregate content from other wordpress blogs
- i've written a wordpress plugin, which uses the class-IXR.php to send blogposts via XML-RPC to the motherblog.
- to sync the post date i'm converting the post_date via new IXR_Date() but the current implemetation returns a invalid string.
- using my fix solves the problem and returns a valid XML-RPC IXR_Date string
it is a known bug in IXR_Date. see http://www.freelists.org/post/dokuwiki/Bug-IXR-DateparseIsoiso-works-incorrect
$client = new IXR_Client($xmlRpcUrl);
$params [] = $id;
$params [] = $this->wpUser;
$params [] = $this->wpPassword;
$params [] = array(
'title' => $title,
'categories' => $categories,
'description' => $content,
'mt_excerpt' => $excerpt,
'mt_keywords' => $tags,
'custom_fields' => $customFields,
'date_created_gmt' => new IXR_Date($date),
'post_status' => $publish
);
$params [] = $publish != 'publish' ? 0 : 1;
$result = $client->query('metaWeblog.newPost', $params);
thanks.
- Keywords dev-feedback added; has-patch removed
will it be applied in 3.0.1? :)
- Keywords reporter-feedback added; dev-feedback removed
- Milestone set to Unassigned
- Resolution worksforme deleted
- Status changed from closed to reopened
- Version changed from 3.0 to 2.9.2
Re-reading the comment mathiasschopmans, I can't tell whether he offered a patch, or a way to properly use IXR_Date. This ticket should only be closed as worksforme if there's no bug here.
If there is a bug we can fix, it's been around for a while, so we would not fix this in 3.0.1.
Re-opening for review.
comment:7
mathiasschopmans — 3 years ago
- Version changed from 2.9.2 to 3.0.1
i'm sad, that the patch isn't applied in 3.0.1. writing an iphone app, which uses xmlrpc as transport and have to fix class-IXR.php everytime i update wordpress cause of the bug.
i attached my class-IXR.php here: http://core.trac.wordpress.org/attachment/ticket/13300/class-IXR.php
@ocean90 transformed it to a patch: http://core.trac.wordpress.org/attachment/ticket/13300/class-IXR.patch
comment:8
mathiasschopmans — 3 years ago
stop. maybe i got it wrong. testing...
comment:9
mathiasschopmans — 3 years ago
- Resolution set to invalid
- Status changed from reopened to closed
new IXR_Date(mysql2date("Ymd\TH:i:s", $post->post_date, false));
shame on me! excuse me.
comment:10
nacin — 3 years ago
- Milestone Awaiting Review deleted

fix