﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
14868	Inconsistent return type calling wp.newCategory method via XML-RPC	mwidmann		"Calling the XML-RPC method {{{wp.newCategory}}} doesn't always return {{{int}}} as described in the Codex or the inline documentation, but also returns {{{string}}} values with the new ids.

Example call:
{{{
<?xml version=""1.0""?>
<methodCall>
  <methodName>wp.newCategory</methodName>
  <params>
    <param>
      <value>
        <string>1</string>
      </value>
    </param>
    <param>
      <value>
        <string>USERNAME</string>
      </value>
    </param>
    <param>
      <value>
        <string>PASSWORD</string>
      </value>
    </param>
    <param>
      <value>
        <struct>
          <member>
            <name>name</name>
            <value>
              <string>vol</string>
            </value>
          </member>
          <member>
            <name>parent_id</name>
            <value>
              <string>0</string>
            </value>
          </member>
          <member>
            <name>description</name>
            <value>
              <string />
            </value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodCall>
}}}

You can call it using {{{wget}}} on the shell like this:

{{{
 $ wget -S -O - --post-file=/tmp/post-body.txt http://URL_TO_YOUR_3.0.1_INSTALLATION/xmlrpc.php
}}}

The Response will look like this:

{{{
<?xml version=""1.0""?>
<methodResponse>
  <params>
    <param>
      <value>
        <string>7</string>
      </value>
    </param>
  </params>
</methodResponse>
}}}

If you call it a second time it will return the category id for the existing category in this form:

{{{
<?xml version=""1.0""?>
<methodResponse>
  <params>
    <param>
      <value>
        <int>7</int>
      </value>
    </param>
  </params>
</methodResponse>
}}}

I'm trying to write an import application using C# using xml-rpc.net to migrate ~1k categories and ~800k contents to WordPress and this is a bit of a blocker for me.

The easiest fix could be to just replace line 946 in {{{xmlrpc.php}}}  with
{{{
return (int) $cat_id;
}}}

In order to always return {{{int}}}

In the meanwhile I'll extend xmlrpc_methods with a copy of the method and the fix."	defect (bug)	closed	normal		XML-RPC	3.0.1	normal	worksforme		
