Currently, hook_xmlrpc allows developers to declare 0 or 1 signature, but the introspection spec allows multiple signatures per method.

A simple way of achieving this would be to slightly change hook_xmlrpc() so that when using the second format, the optional signature argument is no longer a (return, param1, ...) array, but an array of such. This would then allow methodSignature to return the multiple signatures as described in the introspection spec, working around issues like #749572: XML-RPC Server returns failure if you send less than the correct amount of arguments even when arguments are optional in an interoperable fashion instead of using our custom way of defining optional parameters.

This is basically how the Python twisted package does it, for instance: http://twistedmatrix.com/documents/10.1.0/web/howto/xmlrpc.html#auto3 they add an array of signature arrays to the package.

CommentFileSizeAuthor
#2 xmlrpc_897140.patch2.25 KBfgm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fgm’s picture

Version: 8.x-dev » 7.x-dev
Category: feature » bug

Actually, this is not a feature, but a bug in our current implementation. As specified in the introspection spec "The result is an XML-RPC array, with each element representing one method signature. The array is a list of the signatures of the method. There are no duplicate signatures.".

But what system.methodSignature currently returns is just one such element, and not an array of them. So, even if we do not want to allow hook_xmlrpc implementations to declare multiple possible signatures, we MUST return an array of signatures for interoperability, even if it contains only one element: the spec acknowledges that The list does not necessarily contain all possible signatures anyway.

This bug has been there since the "new" XML-RPC implementation in Drupal 4.6.3. The "old" XML-RPC layer was apparently correct in that regard, though, as it would build an array of arrays.

fgm’s picture

Status: Active » Needs review
FileSize
2.25 KB

If we do not want to enact bigger changes, this minimal patch makes us compliant/interoperable with the spec, without changing the hook_xmlrpc definition to allow multiple signatures.

It includes an extra test for the format of methodSignature.

fgm’s picture

Title: XML-RPC subsystem should support multiple signatures » system.methodSignature returns incorrect and incomplete data

making title more accurate

fgm’s picture

#2: xmlrpc_897140.patch queued for re-testing.

For whomever wants to review this patch, the spec is here: http://xmlrpc-c.sourceforge.net/introspection.html

mlncn’s picture

Status: Needs review » Reviewed & tested by the community

I hope no one is relying on the incorrect implementation, but as this is what is returned not accepted there is no other way to correct. RTBC.

dawehner’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x and 8.x, even though it is a small API change. It's a bugfix though -- it is important to follow the specification.

bfroehle’s picture

Issue tags: -Needs backport to D7

Untagging since it's been committed to 7.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.