When a method is described to hook_xmlrpc without a signature (i.e. either in the simple format or in the complex format with only two parameters), if system.methodSignature is invoked on it, we return a -32601 server error, overloading the standard meaning of error -32601 ("server error. requested method not found" as per http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php) with a message saying the signature was not found.
This appears to have been inspired by the behaviour of the Incution XML-RPC library, but does not match the recommended behaviour of the XML-RPC introspection spec, which says The system.methodSignature result may indicate that the introspection machinery simply does not know what signatures the method has. We call this the "I don't know" result. The "I don't know" result consists of an XML-RPC string with value undef.
. In short, asking for the signature of a method without one should not cause an error, but return this "undef" result, or actually anything not a XML-RPC array. As per the spec again: Alternatively, the result can be anything at all that is not an XML-RPC array. The string undef is preferred
.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | xmlrpc-897130-signature-return-undef.patch | 6.01 KB | megachriz |
| #3 | xmlrpc-897130-tests-only.patch | 3.05 KB | megachriz |
Issue fork xmlrpc-897130
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
Daniel Norton commentedSee this item for a patch for 7.x-dev:
#897142: XML-RPC introspection protocol breaks for servers that don’t provide signatures
Comment #2
gregglesAfter #1285726-48: Remove XML-RPC moving this to the contributed module home for xmlrpc issues.
Comment #3
megachrizI've worked on this and used #897142: XML-RPC introspection protocol breaks for servers that don’t provide signatures as inspiration.
I've fixed that when calling "system.methodSignature" for a method that has no signature, the string "undef" gets returned and that there is no XML-RPC error.
Warnings logged
Previously, if a XML-RPC method was defined in the complex format, but without a signature defined, you would get the following warnings logged:
With the change from the patch signature and help have become optional in the complex format. But method name and callback remain required. Therefore I added that a warning must be logged if the XML-RPC method is not correctly defined. When it is missing the method name or callback, it now results into the following logged message with a suggestion of how to fix it:
Signaure is not an array
When a signature is defined, but it is not an array, there is still a XML-RPC error. This time the error message is as follows, with the word 'correctly' being added:
Instead of it being a -32601 error, it is now a -32602 error. On https://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php it is said that that code means "-32602 ---> server error. invalid method parameters". One of the parameters is invalid if the signature is not defined as an array, so it looks me that that error code fits here.
Static class callbacks
I also fixed that static class callbacks can be used for a XML-RPC method:
Ideally, this should be fixed in a separate issue, but I wanted to ensure that for the above definition - for which a signature is also not defined - calling the "system.methodSignature" method for it would result into the same.
The test only patch should fail tests. Let's see if the other patch passes tests.
Comment #7
megachrizMerged the code!
Comment #8
fgmThanks for your work on this old issue.