Background: I'm using Emacs's weblogger.el mode to post to my blog. This has been almost working for quite a while but there was one remaining annoyance. Namely, any new posts created in weblogger mode would show up as if they were 'older' than the first post to the blog. What was even odder was that they always displayed the current date and time instead of the creation timestamp. It turns out that weblogger (at the moment, but I intend to fix that sooner or later) sends rubbish data in the dateCreated node if you're posting via metaWeblog_newPost. Unfortunately this rubbish data is then interpreted as a bona fide timestamp, the function that decodes the timestamp returns 0 and I would guess 0 ends up in the database...
Anyway, the patch below fixes this by only accepting timestamps that are non-zero. A quick test on my blog suggests that this fixes the problem so it might be worth including this in the next release of the plugin.
Yes, I know that this is probably the wrong place to fix this issue but IMHO serendipity shouldn't really accept '0' as a timestamp via XML-RPC
Code: Select all
--- serendipity_xmlrpc.inc.php.orig 2009-08-02 19:14:51.000000000 +0100
+++ serendipity_xmlrpc.inc.php 2009-08-02 19:16:55.000000000 +0100
@@ -448,7 +448,10 @@
$entry['moderate_comments'] = serendipity_db_bool($serendipity['moderateCommentsDefault']);
if (isset($post_array['dateCreated'])) {
- $entry['timestamp'] = XML_RPC_iso8601_decode($post_array['dateCreated'],($post_array['dateCreated']{strlen($post_array['dateCreated'])-1} == "Z"));
+ $timestamp = XML_RPC_iso8601_decode($post_array['dateCreated'],($post_array['dateCreated']{strlen($post_array['dateCreated'])-1} == "Z"));
+ /* Fix for broken clients that send rubbish in the dateCreated node */
+ if ($timestamp != 0)
+ $entry['timestamp'] = $timestamp;
}
ob_start();