Apparently, the system.multicall implementation is broken, as - when no error occurs - it returns a plain array of results, whereas it should return an array of one-element arrays containing the result of each method.
As per the spec (emphasis added) The result will either be a one-item array containing the result value (this mirrors the use of
in ), or a struct of the form found inside the standard element.
The same problem is present in each and every version since Drupal 4.5 when multicall was introduced in xmlrpcs.inc, including the latest HEAD, and can be double checked using the XML-RPC reference multicall test from http://xmlrpc-c.sourceforge.net/hacks/test_multicall.py
The attached patch fixes the problem. Strictly equivalent patches can be applied to each version since 4.5 included.
| Comment | File | Size | Author |
|---|---|---|---|
| #36 | 0001-Issue-646678-by-fgm-Fixed-incorrect-XML-RPC-multical.patch | 3.46 KB | fgm |
| #32 | xmlrpc47_32.patch | 4.98 KB | fgm |
| #31 | xmlrpc5_31.patch | 2.86 KB | fgm |
| #30 | xmlrpc_30.patch | 3.87 KB | fgm |
| #29 | xmlrpc_29.patch | 3.87 KB | fgm |
Comments
Comment #1
fgmForgot to set status.
Comment #2
fgmAnd here is the version for today's HEAD.
Comment #3
dries commentedHow about some tests? #639608: Provide assertXmlrpc() function to inspect and verify XML-RPC messages might be a requirement, or at least, could help make testing a lot easier.
Comment #5
fgmOf course, this means we also had the matching error in our client so that both worked together (but not with third party implementations). So the client and simpletest also need to be fixed, which is less simple than the server side. Time to look again at Dries' suggestion for assertXml(), it seems.
FWIW, the default ruby implementation has a specific implementation for multicall (multicall calls multicall2, call gen_multicall, which unwraps the 1-element array from the result) as opposed to standard calls. We might want to do something similar.
Comment #6
fgmA better patch, covering both client and server. Works with both Drupal and non-Drupal implementations.
Comment #7
dries commentedThis is somewhat fuzzy. Care to provide a better comment? Looks good, and it pretty easy to understand, but let's come up with a nicely written comment. Should be RTBC.
Comment #8
fgmHow about this one ? Maybe too verbose ?
Comment #9
fgmResubmitting to trigger test bot, which appears to remain stuck.
Comment #10
fgmOops, wrong patch :-(
Comment #11
sunWhat means "OK" ?
Wrong comment style. We do not use multi-line comments within function bodies; always use inline comments here.
In addition, this comment reads a bit lengthy - just clarifying what the expected result for multicalls (and difference to single methods) is should be sufficient.
What is happening here?
Also, we should not abbreviate $ret[urn]
Comment #12
fgmMoved the main comment in the function phpdoc and rewritten. How about this version ?
Comment #15
fgm(failed test is FileDeleteTest, which is AFAIK unrelated with XMLRPC)
Comment #16
dries commentedThis looks valid to me. Let's see if there are any final reviewers.
Comment #17
sunLooks indeed much better now.
Should not wrap early, but at 80 chars instead.
Missing leading ' * '.
Use a Doxygen list here instead? See http://drupal.org/node/1354 for proper formatting of lists.
This review is powered by Dreditor.
Comment #18
fgmHow about this version, then ?
Regarding the 80-column folding, I had looked for it previously but it does not currently appear on http://drupal.org/node/1354, which led me to wrap early at a more significant place, as you noticed.
This which may be a documentation bug, since we have similar recommendations
Comment #20
dave reidMy bad.
Comment #27
sunThis can be backported to D6.
Comment #28
dries commentedCommitted to CVS HEAD. Changing version and status.
Comment #29
fgmHere is a D6 version.
Here too, server side tested with the multicall client from http://xmlrpc-c.sourceforge.net/hacks/test_multicall.py
Comment #30
fgmGrrr... missing space.
Comment #31
fgmAnd an almost identical patch for D5. Server also tested with the python client.
Comment #32
fgmAnd of course, while I was at it, the D47 version, with a few fixes which had appeared in the meantime. Luckily, the API change on xmlrpc_error() was not needed to apply the fix.
Also tested with the multicall.py client too.
We could go probably on, since this version dates back to 4.5...
Comment #33
dries commentedReviewed the D6 version. Looks great.
Comment #35
cyberwolf commentedSubscribing.
Comment #36
fgmRerolled D6 patch.
Comment #37
fgmResetting to RTBC now that it is rerolled, as Dries had set it in #33.