XMLRPC fixes from Joseph Scott. 404 for invalid post ids. Return empty array if no pages are present.
git-svn-id: http://svn.automattic.com/wordpress/trunk@5098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bb7d61596d
commit
84cda2c6bb
11
xmlrpc.php
11
xmlrpc.php
|
@ -261,7 +261,6 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
}
|
||||
|
||||
// Lookup info on pages.
|
||||
$pages = array();
|
||||
$pages = get_pages();
|
||||
$num_pages = count($pages);
|
||||
|
||||
|
@ -280,7 +279,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
}
|
||||
// If no pages were found return an error.
|
||||
else {
|
||||
return(new IXR_Error(404, "Sorry, no pages were found."));
|
||||
return(array());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1090,6 +1089,14 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
||||
|
||||
$postdata = wp_get_single_post($post_ID, ARRAY_A);
|
||||
|
||||
// If there is no post data for the give post id, stop
|
||||
// now and return an error. Other wise a new post will be
|
||||
// created (which was the old behavior).
|
||||
if(empty($postdata["ID"])) {
|
||||
return(new IXR_Error(404, "Invalid post id."));
|
||||
}
|
||||
|
||||
extract($postdata);
|
||||
$this->escape($postdata);
|
||||
|
||||
|
|
Loading…
Reference in New Issue