#13300 closed defect (bug) (invalid)
class IXR_Date transforms invalid timestamp.
| Reported by: | nasenmann | Owned by: | josephscott |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | XML-RPC | Version: | 3.0.1 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: | Focuses: |
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)
#1
@
16 years ago
Can you provide details on what exactly the problem is? Precise steps on how to reproduce it would be very helpful.
#2
@
16 years ago
- Keywords reporter-feedback added; IXR_Date XML-RPC removed
- Milestone 2.9.3 → Unassigned
#3
@
16 years ago
- Keywords has-patch added; reporter-feedback removed
- Resolution → worksforme
- Status new → closed
- Version 2.9.2 → 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.
#6
@
16 years ago
- Keywords reporter-feedback added; dev-feedback removed
- Milestone → Unassigned
- Resolution worksforme
- Status closed → reopened
- Version 3.0 → 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.
#7
@
16 years ago
- Version 2.9.2 → 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
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
fix