From 2185aa37230306c645cfc9ac310cc4f90907e8c5 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sun, 25 Mar 2007 03:53:33 +0000 Subject: [PATCH] XMLRPC fixes from Joseph Scott. 404 for invalid post ids. Return empty array if no pages are present. git-svn-id: https://develop.svn.wordpress.org/trunk@5098 602fd350-edb4-49c9-b593-d223f7449a82 --- xmlrpc.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xmlrpc.php b/xmlrpc.php index 17c50e0a42..69c7750d9e 100644 --- a/xmlrpc.php +++ b/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);