[ php-blog-Bugs-1902746 ] XMLRPC plugin v1.34 - categories not set correctly

"SourceForge.net" <[email protected]> Tue, 26 Feb 2008 21:12:56 -0800
Newsgroups gmane.comp.serendipity.trackers
Message-ID <[email protected]>
Bugs item #1902746, was opened at 2008-02-27 16:12
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=542822&aid=1902746&group_id=75065

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Plugins
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Mike Tyson (tzi)
Assigned to: Nobody/Anonymous (nobody)
Summary: XMLRPC plugin v1.34 - categories not set correctly

Initial Comment:
When creating/updating a post over XMLRPC, categories cannot be set.  Database shows a single category with ID 0 is assigned to post afterwards.

The problem is in serendipity_xmlrpc.inc.php, line 735.  When saving a post, the entry is passed through universal_fixEntry(), which, if no categories are set, sets the categories array to Array(0 => 0), which is incorrect as far as I can tell.

Then, the saving routine goes on to step through this category array, and create a single category link to category 0 (which doesn't exist for me anyway), overwriting anything else.  If category wasn't set, it wouldn't adjust the database.

The mt.setPostCategories entry point does the right thing, but because of the buggy universal_fixEntry() function, saving the post (which for me happens immediately after setPostCategories, using Ecto) then resets the category too.

Commenting out the three lines starting with line 735:

    if (!is_array($entry['categories']) || count($entry['categories']) < 1) {
        $entry['categories'] = array(0 => 0);
    }

...makes this problem go away, I think.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=542822&aid=1902746&group_id=75065

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/