Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13300 closed defect (bug) (invalid)

class IXR_Date transforms invalid timestamp.

Reported by: nasenmann Owned by: josephscott
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: XML-RPC Keywords: reporter-feedback
Focuses: Cc:


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)

class-IXR.php (28.4 KB) - added by nasenmann 8 years ago.
class-IXR.patch (1.2 KB) - added by ocean90 8 years ago.

Download all attachments as: .zip

Change History (12)

8 years ago


8 years ago

#1 @josephscott
8 years ago

Can you provide details on what exactly the problem is? Precise steps on how to reproduce it would be very helpful.

#2 @nacin
8 years ago

  • Keywords reporter-feedback added; IXR_Date XML-RPC removed
  • Milestone changed from 2.9.3 to Unassigned

#3 @mathiasschopmans
8 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);


#4 @nacin
8 years ago

  • Milestone Unassigned deleted

#5 @nasenmann
8 years ago

  • Keywords dev-feedback added; has-patch removed

will it be applied in 3.0.1? :)

#6 @nacin
8 years ago

  • 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.

#7 @mathiasschopmans
8 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

#8 @mathiasschopmans
8 years ago

stop. maybe i got it wrong. testing...

#9 @mathiasschopmans
8 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.

#10 @nacin
8 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.