[wp-trac] [WordPress Trac] #27141: XML-RPC API does not accept login parameters.
WordPress Trac
noreply at wordpress.org
Mon Feb 17 02:32:27 UTC 2014
#27141: XML-RPC API does not accept login parameters.
---------------------------+-----------------------------
Reporter: lucasdaddiego | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: XML-RPC | Version: 3.8.1
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
Hi, i was trying to use the XML-RPC api, but I couldn't make it work.
I'm using a xml-rpc client for Chrome, (but i think that this happens with
any client, because it's a php thing). The method i was trying was
wp.getPosts(but it's general for all the methods). I passed the blog_id,
the username, and the password, but the response was always a message with
"Invalid username or password", but the username and password combination
was right.
I enabled the debug logging, and in the log (wp-content/debug.log)
appeared the following text:
{{{
PHP Notice: Undefined offset: 0 in /opt/lampp/htdocs/test1/wp-includes
/class-wp-xmlrpc-server.php on line 1443
PHP Notice: Undefined offset: 1 in /opt/lampp/htdocs/test1/wp-includes
/class-wp-xmlrpc-server.php on line 1444
PHP Notice: Undefined offset: 2 in /opt/lampp/htdocs/test1/wp-includes
/class-wp-xmlrpc-server.php on line 1445
}}}
Then I discovered that in the methods(for example, in line 1444) of the
file /wp-includes/class-wp-xmlrpc-server.php the args are read in the
following way:
{{{
$this->escape( $args );
$username = $args[0];
$password = $args[1];
}}}
But, that doesn't work.
Then, I tried changing the code like this:
{{{
$username = $args['username'];
$password = $args['password'];
}}}
And it worked!
I'm running wordpress in a dev environment, with latest XAMPP, PHP 5.5.6,
and Kubuntu 13.10 x64.
I hope i'm not breaking any rule, and this might be helpful.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27141>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list