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

"SourceForge.net" <[email protected]> Wed, 05 Mar 2008 16:47:59 -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 (Comment added) made by tzi
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: Fixed
Priority: 1
Private: No
Submitted By: Mike Tyson (tzi)
Assigned to: Garvin Hicking (garvinhicking)
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.

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

>Comment By: Mike Tyson (tzi)
Date: 2008-03-06 11:47

Message:
Logged In: YES 
user_id=662514
Originator: YES

Issue is resolved!  Nice work.

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

Comment By: Garvin Hicking (garvinhicking)
Date: 2008-02-27 19:33

Message:
Logged In: YES 
user_id=473563
Originator: NO

Hi Mike!

Many thanks for reporting this. This bug has been introduced a few days
ago. ACtually the "0" category ID is required for entries that have no
category. But you are right, the place it was injected made the
setPostCategories() function call irrelevant.

I've now committed a different approach to version 1.35 of the plugin,
shortly available in Spartacus. I'd be very happy if you can check out that
version and see if your issue is resolved?

Regards,
Garvin

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

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/