Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The doc for hook_nodeapi() is pretty clear that the 3rd and 4th params must be options. http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo... However, some core implemtations make it required.
example: http://api.drupal.org/api/drupal/modules--path--path.module/function/pat...
This cause's errors when invoking hook_nodeapi with just the 1st 2 params (which are all that should be required).
Comment | File | Size | Author |
---|---|---|---|
#5 | 1260932-nodeapi.patch | 3.49 KB | DjebbZ |
#2 | 1260932-nodeapi.patch | 5.9 KB | DjebbZ |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedtagging as Novice, since this is a really easy patch.
All core implenetations need to be checked, but upload_nodeapi(), trigger_nodeapi() and path_nodeapi() clearly have the problem.
Comment #2
DjebbZ CreditAttribution: DjebbZ commentedBasically I fixed all implementations of hook_nodeapi in core (more than 3 !). (My first core patch)
Comment #3
DjebbZ CreditAttribution: DjebbZ commentedSorry
Comment #4
pwolanin CreditAttribution: pwolanin commentedI think this needs work - some of the changes add a 4th param (not needed) or change the name of the 3rd param:
I think we don't need the change above at all. The main thing is to make sure that any 3rd or 4th params defined are optional (have a default value).
For example, I would change path_nodeapi() to:
Comment #5
DjebbZ CreditAttribution: DjebbZ commentedWhat about statistics module ? third parameter is 0, not NULL. Same for taxonomy.
function statistics_nodeapi(&$node, $op, $arg = 0) {
Comment #6
pwolanin CreditAttribution: pwolanin commentedI think it's fine for them to be 0 instead of NULL at this point - as long as there is a default value, it's optional.
Comment #7
DjebbZ CreditAttribution: DjebbZ commentedSorry again.
Comment #8
DjebbZ CreditAttribution: DjebbZ commentedOk I understant. Cool.
Comment #9
pwolanin CreditAttribution: pwolanin commentedok, so the modified modules are:
modules/book/book.module
modules/forum/forum.module
modules/path/path.module
modules/translation/translation.module
modules/trigger/trigger.module
modules/upload/upload.module
Applied this patch, enabled all those module and did some basic functional tests. Didn't see (or expect) any errors.
Patch also looks good - minimal change to comply with the API and make 3rd and 4th params optional.
Comment #10
DjebbZ CreditAttribution: DjebbZ commentedSo basically, i wrote my first patch for core :) /me is happy :)
I'll continue with core issues tagged "Novice", they fit me well.
Comment #11
gateway69 CreditAttribution: gateway69 commentedIm also seeing this issue, im curious if I should apply the patch here..
Warning: Missing argument 4 for views_attach_nodeapi(), called in /var/www/html/content/sites/all/modules/apachesolr/apachesolr.index.inc on line 63 and defined in views_attach_nodeapi() (line 86 of /var/www/html/content/sites/all/modules/views_attach/views_attach.module).
Comment #12
pwolanin CreditAttribution: pwolanin commented@gateway69 - no, it looks to be a corresponding bug in the views_attach module. Please file the bug there.
Comment #13
Gábor HojtsyOk, reviewed, looks simple and straightforward. Committed. Thanks.
Comment #14
DjebbZ CreditAttribution: DjebbZ commented/me very happy :) First patch to core :)