Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10513 closed defect (bug) (fixed)

Custom XML-RPC methods can't reuse functions in WordPress' XML-RPC server object

Reported by: davecpage's profile davecpage Owned by: josephscott's profile josephscott
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.3
Component: XML-RPC Keywords: extending xmlrpc has-patch needs-testing
Focuses: Cc:

Description

When extending XML-RPC with custom methods you cannot reuse the functions of the main WordPress wp_xmlrpc_server object. The object does all it's work within the constructor function and by the time any other code could use the global variable $wp_xmlrpc_server everything has finished.

This issue was discovered during the recent WordCampUK WordHack session and meant we couldn't reuse the built-in login function of wp_xmlrpc_server to authenticate a user.

The code just needs to finish assigning the object to $wp_xmlrpc_server on line 3405 then have a separate function that calls the base IXR_Server function on line 204.

I have a patch that adds this extra step but it can be adjusted if needed.

Attachments (2)

xmlrpc.diff (459 bytes) - added by davecpage 15 years ago.
xmlrpc.php.diff (475 bytes) - added by josephscott 15 years ago.

Download all attachments as: .zip

Change History (4)

@davecpage
15 years ago

#1 @josephscott
15 years ago

  • Cc joseph@… added
  • Milestone changed from Unassigned to 2.9
  • Version changed from 2.9 to 2.8.3

This sounds fine. I did have a problem with seg faulting with your patch though. Seems it didn't like having a class method called serve. I've created a new patch changing this to serve_request and it stopped seg faulting.

#2 @westi
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11789]) Seperate out the XML-RPC server active behaviour from object construction so that plugins can use the utility functions when extending the XML-RPC server. Fixes #10513 props davecpage.

Note: See TracTickets for help on using tickets.