Closed (fixed)
Project:
Drupal core
Component:
base system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
22 Feb 2005 at 21:26 UTC
Updated:
15 Mar 2005 at 21:15 UTC
Jump to comment: Most recent, Most recent file
Try this: module_invoke('taxonomy', 'get_tree', 1); and compare the results with taxonomy_get_tree(1);
What happens is that taxonomy_get_tree is called by the arguments 1, NULL, NULL, NULL which breaks it.
Hence the patch.
Every Drupal version I have met (4.4, 4.5, CVS) contains this error. I think this led module authors to not use module_invoke (at least I did so until now) which will be quite a problem if we decide on breaking up the modules into smaller pieces.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | module_invoke_0.patch | 1.92 KB | chx |
| #8 | module_invoke.patch | 1.84 KB | chx |
| #3 | themefix_0.patch | 712 bytes | chx |
| #2 | module_inc_no_default_nulls_0.patch | 625 bytes | chx |
| module_inc_no_default_nulls.patch | 685 bytes | chx |
Comments
Comment #1
killes@www.drop.org commentedI have no idea how else we should fix this. +1.
Comment #2
chx commentedOf course, lambda is another solution. When I objected on IRC that call_user_func_array is slower, Bart Jansens pointed out that slashdotted pages are cached thus module_invoke is not called. So if this solution is accepted, the credit goes to him.
But one of the solutions shall be accepted.
Comment #3
chx commentedThe message was wrong (but funny).
Comment #4
chx commentedSorry, posted to the wrong issue. :(
Comment #5
dries commentedmodule_invoke_allneeds to be updated as well.Comment #6
chx commentedmodule_invoke_all, sure, just tell me which approach is accepted (lambda or switch(func_num_args())
References? module_invoke does not accept references, that's why we have node_invoke and nove_invoke_nodeapi (these may be wrong, too) and user_invoke (this one has only one NULL, in a very specific place, so most probably it won't break anything).
So, let's agree on one way or another and I'll patch module_invoke_all, node_invoke, node_invoke_nodeapi too.
Comment #7
dries commentedBart's approach is preferred.
Comment #8
chx commentedHere is a fix for module_invoke_all and module_invoke.
Turns out that the node_invoke and nove_invoke_nodeapi and user_invoke does not need replacement.
There was a related bug in user.module, where necessary NULL parameters were not in the module_invoke call, that's fixed, too.
Also, module_invoke_all uses module_implements which is good if one hook (say hook_nodeapi) is called more than once and does no harm if it is called only once.
Comment #9
chx commentedI think this one is better.
Comment #10
dries commentedCommitted to HEAD.