Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
xml-rpc system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Aug 2010 at 17:56 UTC
Updated:
3 Jan 2014 at 01:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pwolanin commentedAlso having options is needed if you want to pass in additional headers (e.g. for web services that require authentication headers) for the http request.
Comment #2
heine commentedI've only done a visual inspection, but this is a welcome change if only for the timeout setting of drupal_http_request that can be passed through.
Method, the content-type header and data are required by the XMLRPC "specification", so it makes sense to not allow changing those settings.
Comment #3
pwolanin commentedhmm, looks like this will fail - need to convert the tests.
Comment #4
pwolanin commentedwith test fixes
Comment #5
dries commentedObviously an API change but I think it is worth it. Ideally, this would be re-factored a bit in Drupal 8. Would love to get other people's take on this.
Comment #6
sunTough. I'd agree that being able to pass options to dhr() is needed (potentially having a requirement for that in contrib). However, this is quite an API change...
I wonder whether we could support backwards compatibility until D8...
Old:
New:
Hm. So while the old $singlecall syntax could be easily supported, the new $singlecall syntax clashes with the old $multicall, they are identical.
However, even only ensuring BC for the old $singlecall syntax would be beneficial at this point in time, so we'd only need to announce an API change for multicalls (which are used rarely), i.e.
I tried hard, but failed to understand how to pass a single method with or without arguments, and how to do a multicall. It was relatively clear with the previous variable amount of arguments.
Most probably, even after improving the param description for $args, we want to add example code to the PHPDoc of xmlrpc().
1) Description for optional arguments should be prefixed with "(optional)". See http://drupal.org/node/1354 for detailed example code.
2) Technically, $options are also optional for _xmlrpc(). I'd recommend to keep both function signatures identically.
Powered by Dreditor.
Comment #7
damien tournoud commentedCould we change the signature of $url?
Comment #8
damien tournoud commented... after all $options are for the transport, so it makes sense to have them close to (or in that case: inside) $url.
Comment #9
dries commentedStuffing everything in one call is never going to be clean, nor easy. In Drupal 8, I think we want to make this object oriented.
Pseudo-code:
I'm not sure it make sense to keep Drupal 8 in mind.
Comment #10
pwolanin commented@sun - the code changes needed for this API change are pretty trivial - look at the tests. You just wraps the arguments in an array.
given that most modules that use it only make RPC calls in one or two places (including one I maintain), I really, really don't think it's worth making this more complex than it needs to be.
Comment #11
pwolanin commented@Dries - if this is going to be OO in Drupal 8, then maybe we will just adopt a library?
Comment #12
sunSomehow, the proposed new syntax looks wonky. Stuffing method name + arguments into a list was really only valid and "useful" for the old/current function signature.
When changing the syntax, the following would be more appropriate:
And using this syntax, we can retain full BC.
Comment #13
sunJust incorporated my review issues from #6 for now.
Trying to burn #12 now.
Comment #14
sunBurned it.
Comment #16
pwolanin commentedNo, I really, really don't think we should care about BC for such a rarely used function. That flies against our whole philosophy.
Comment #17
pwolanin commentedLet's keep this simple - I'm reposting the same changes as in #13 - I think this is RTBC. The upgrade from D6 can be done essentially automatically via regex replace.
Comment #18
sunwell, we can surely drop the BC code (though I'd disagree, it's simply too late for D7), but I'd highly prefer the $args structure as contained in #14.
The entire invocation of xmlrpc() is much more clean and clear with that.
EDIT: In case it's not immediately clear, #12 contained usage examples for the new syntax implemented in #14.
Comment #19
pwolanin commentedThe patch in #17 works - the one in #14 I am getting weird xmlrpc errors:
I really don't think it's worth more effort to get a syntax that's just a little cleaner. I still assert #17 is rtbc.
Comment #20
sunMy point is that if we change the arguments, then we should use sane arguments. Compare:
One of both makes sense.
Comment #21
pwolanin commented@sun - I agree the second form is "nicer", but they both make sense (i.e. conform to a reasonable logic). But apparently it does not work, and I don't think it's worth the effort at this point to debug to achieve "nicer" in order to fix the big: the bug is that we cannot pass options to the http request.
The time and effort to get the "nicer" syntax working is far better spent fixing a critical bug so we can get D7 out. Please!
Comment #22
sunIt just failed because of a stupid variable name clash.
Still contains BC code. Whether we should or can break BC here should be decided by Dries/webchick. IMHO, we should not (D7CX frustration), if we don't have to, and we don't have to.
Remember that certain people started to build pretty large sites on D7 already. You can count on me on break ya APIs at this stage, but only if we really have to.
Comment #23
dries commentedPersonally, I think we should go with option 2 from #20.
Comment #24
sun@Dries: #22 is option 2 from #20. Question is whether to preserve backwards compatibility or not (latest patch in #22 does).
Comment #25
dries commentedI think we can still break backwards compatibility -- we've done worse things. Once we're in beta, it will be an absolute "no go".
Comment #26
sunRemoved. Also clarified usage in PHPDoc.
Comment #27
pwolanin commentedReviewed the patch and discussed with Sun in chat. Looks good to me.
Comment #28
dries commentedAlright. Committed to CVS HEAD. Thanks.
We need to document that in the upgrade instructions. Let's mark this fixed after.
Comment #29
sunThe good news is that the new syntax can be backported, therefore allowing custom headers and a custom retry value in D6, too.
Comment #30
sunTiny mistake for system.multicall in that BC code.
Comment #31
pwolanin commentedhttp://drupal.org/update/modules/6/7#xmlrpc
Comment #32
pwolanin commentedoops - cross post - see above for D7 API docs
Comment #33
andypostI think that $args should be optional to be backported
Comment #34
sun@andypost: $args neither is nor was optional.
Comment #35
pwolanin commenteddocs are already added
Comment #36
andypost@sun, I mean that signature should be
Specially for d6 else be get a api incomputability and possible errro messages (php warnings or notices)
Comment #37
sun@andypost: See #34. $args has never been optional. D6 expects either a method name string or an array as second function argument. Not passing anything triggers an error in _xmlrpc().
Comment #38
eric_a commentedA D6 module that depends on the new signature needs to check the Drupal version. Should this be mentioned in the doc block?
Comment #39
andypost@Eric_A, No need because implementation is backward compatible... so I see no reason against ...
RTBC++
Comment #40
pwolanin commentedIs this a robust check?
Comment #41
sunThat's why I posted the usage examples:
D6:
D7:
With the new argument, 1) $args is never a string and 2) $args[0][0] is never set, it could only be a string key, $args['firstMethod'][0].
Comment #42
eric_a commentedAlso having options is needed if you want to pass in additional headers (e.g. for web services that require authentication headers) for the http request.
If a D6 module depends on passing in additonal headers, it will depend on this new implementation. If the module doesn't require the correct version of Drupal, it will not function. Why should it not be needed to document this important information?
Comment #43
pwolanin commentedI think the point of mentioning a hook_requirements check for VERSION is useful to add to the doxygen.
Comment #44
rfayPretty major D7 API breakage on this one (fgm discovered on XMLRPC Example in Examples project). And it never went to "fixed" so I never saw it - in those kind of cases let me know so I can announce.
Issue summary, please?
Comment #45
andypost@rfay could you provide a link to issue?
Comment #46
andypost@rfay could you provide a link to issue?
Comment #47
rfay@andypost, #894972: XML-RPC test no longer passes, already fixed. But if it breaks xmlrpc_example, there is lots of contrib breakage.
Comment #48
pwolanin commentedThe D7 api change is documented at http://drupal.org/update/modules/6/7#xmlrpc
Comment #49
gddI rerolled this with the requested comments about hook_requirements(). I would really love to get this committed, it would make our lives a lot easier in Services where we could use it for authentication purposes. I did some testing setting headers and it worked great.
Comment #50
gddNew patch to remove trailing spaces.
Comment #51
eric_a commented@heyrocker. Do you happen to have the time to upload an interdiff from the patch in #30 to help me and other reviewers?
Comment #52
eric_a commentedConfirmed that #49 is sun's patch from #30 with 4 lines added to xmlrpc() doc block. Patch in #50 is the same, but with a white space fix that was not in #30 and irrelevant to this patch.
The reroll was for these 4 lines. The one relevant commit to DRUPAL-6 since #30 (affecting common.inc) does not affect this patch.
Back to RTBC as per #39.
Comment #54
eric_a commentedComment #55
rfay#50: 881536_xmlrpc_dhr_options.patch queued for re-testing.
Comment #57
eric_a commentedSetting to RTBC should not trigger a test bot, right?
Well, even if the patch name does not end with -d6 or _D6, the current behaviour might be related to #961172: All D6 Core patches are failing.
Comment #58
rfaySorry, it can't be RTBC if it can't pass the testbot.
Comment #59
eric_a commented@rfay. This a D6 patch... Initially backported by sun. On November 3rd the status changed because of infrastructure hickups, it is presumed.
Comment #60
rfayThis is #50 with the name changed to -d6, no other change. It will factor the testbot out of the equation, if I'm not mistaken.
Sorry for my misunderstanding.
Comment #61
gábor hojtsyUhm, I'm not sure this way of introducing a whole new way to call xmlrpc() is a good idea even if we keep the old ways of calling it intact with special hacks. Eg the new docs will not keep explanation for the old syntax, which I guess most existing Drupal code would still use. So if you'd like to look up why its invoked that way, you'll not even have docs anymore. I'm not convinced.