system.methodSignature should return "undef" instead of error -32601

Created on 30 August 2010, over 14 years ago
Updated 6 June 2023, over 1 year ago

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 . 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: .

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France fgm Paris, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands megachriz

    I'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:

    Undefined array key 2 in xmlrpc_server()
    Undefined array key 3 in xmlrpc_server()

    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:

    Wrongly defined XML-RPC method detected. Check implementations of hook_xmlrpc() and hook_xmlrpc_alter() to see which one is wrong.

    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:

    'Server error. Requested method @methodname signature not correctly specified.'

    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:

    'test.classCallback' => ['XmlRpcTestClass', 'foo'],
    

    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 patch passes tests.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    28 pass
  • @megachriz opened merge request.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    28 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    28 pass
    • MegaChriz β†’ committed be0ded1a on 8.x-1.x
      Issue #897130 by MegaChriz: Fixed system.methodSignature should return "...
  • Status changed to Fixed over 1 year ago
  • πŸ‡³πŸ‡±Netherlands megachriz

    Merged the code!

  • πŸ‡«πŸ‡·France fgm Paris, France

    Thanks for your work on this old issue.

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

Production build 0.71.5 2024