xmlrpcs.inc uses t() with placeholders when reporting error. The placeholde will be surrounded with <em>
tags, and when the message parsing is done in xmlrpc.inc in xmlrpc_message_parse() parts of the message will be cropped.
Example: when requesting an invalid method the result is the following XML:
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>-32601</int></value>
</member>
<member>
<name>faultString</name>
<value><string>Server error. Requested method <em>node.loader</em> not specified.</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
From which the parsed error will be:
[params] => Array
(
[0] => Array
(
[faultCode] => -32601
[faultString] => not specified.
)
)
You can see that the fault string is only part of the original message, moreover it contains a leading white space, which suggests that there was a mistake when the original XML tags were removed. I suggest we remove the extra formatting tags from the faultString, so the parsed message can be retreived.
This bug is also there in Drupal 6, where the same faulty behaviour is expected, but I did not test it.
If you want to test the bug there is an xmlrpc tester module in my sandbox. Patch replaces the placeholders with the actual variables.
Comment | File | Size | Author |
---|---|---|---|
#4 | xmlrpcs_tags_1.patch | 2.47 KB | snufkin |
xmlrpcs_tags.patch | 2.36 KB | snufkin | |
Comments
Comment #1
Jorrit CreditAttribution: Jorrit commentedI think it is better to just replace the % by the @. At least for D6, it will simply not add the
<em>
tag. Together with that, perhaps it is a wise consideration to force XML error responses to English regardless of the system default language.Comment #2
snufkin CreditAttribution: snufkin commentedI am not so sure. You might want to have the error message localized.
I didn't know about the difference between % and @, thanks for that, i will investigate and if it works in 5 too, i will update the patch.
Comment #3
keith.smith CreditAttribution: keith.smith commentedThere are some minor code style violations here (spacing around concatenation operators).
Comment #4
snufkin CreditAttribution: snufkin commentedand indeed the @ sign works even in 5.7. cool, every day a new trick. New patch, I simply replaced the substituting % operators to @, thus no
<em>
tag is in the XML. I will port the patch to 6 as soon as this is fixed.Comment #5
drummReplacing % with @ is the correct approach. However, I would like to see this fixed in the development version, currently 7.x, first, and then backported from there.
Comment #6
Dries CreditAttribution: Dries commentedThe patch didn't apply cleanly against either DRUPAL-6 or CVS HEAD, but I've fixed it up, and committed it to both branches. The patch should go into DRUPAL-5 now. I leave that up to Neil. Lowering the version and updating the status field.
Comment #7
Jorrit CreditAttribution: Jorrit commentedNow I wonder what the procedure is for Drupal 5 bugs? There are still some, for instance http://drupal.org/node/172830. Do they need a patch for Drupal 7 first? What if the issue is not present in Drupal 7? Does this apply for Drupal 6 bugs as well?
Comment #8
drummCommitted to 5.x.
Jorrit- Ideally development is done against HEAD and the backported. There are of course cases where bugs do not exist in more recent versions.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.