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.
When I render a node comment with the Devel module, I'm getting the following errors:
Notice: Undefined variable: node in comment_view() (regel 926 van C:\wamp\www\MYSITE\modules\comment\comment.module).
Notice: Trying to get property of non-object in comment_links() (regel 1039 van C:\wamp\www\MYSITE\modules\comment\comment.module).
Notice: Undefined variable: node in comment_view() (regel 933 van C:\wamp\www\MYSITE\modules\comment\comment.module).
Notice: Trying to get property of non-object in comment_view() (regel 933 van C:\wamp\www\MYSITE\modules\comment\comment.module).
Notice: Undefined variable: node in comment_view() (regel 935 van C:\wamp\www\MYSITE\modules\comment\comment.module).
The errors appear both for comments by anonymous users and registrated users on a fresh website.
Comments
Comment #2
cilefen CreditAttribution: cilefen commentedPlease show us your code.
Comment #3
Jeroen94 CreditAttribution: Jeroen94 commentedThese errors appear in a fresh installation of Drupal 7.39 too, so it is definitely a bug. I deleted the sentence about my custom module to avoid further confusion.
Comment #4
cilefen CreditAttribution: cilefen commentedI am not sure non-specific tags help, which is why I removed them. There are more specific tags for queue management that help maintainers find issues, like "Needs steps to reproduce", which I added. But you are welcome to include them if you feel that it would help. It may.
What exactly do you mean by that?
Comment #5
Jeroen94 CreditAttribution: Jeroen94 commentedOkay, @cilefen, I'll keep that in mind for the future. Thanks for your fast reply by the way! Here are the steps to reproduce the problem:
Step 1:
Step 2:
Step 3:
Comment #6
longwave"Missing argument 2 for comment_view(), called in .../devel.pages.inc on line 267" suggests this is a bug in Devel and not core. The subsequent notices all relate to this missing argument.
I removed the random keywords again.
Comment #7
Jeroen94 CreditAttribution: Jeroen94 commentedThanks for your intervention @longwave. I wasn't sure, so that's why I put it in the Drupal Core queue. I've moved the bug report to the Devel project.
Comment #8
alan-ps CreditAttribution: alan-ps commentedThe same issue on dev version. The second argument (node) is mandatory in function comment_view. In order to fix it, we should add a check. The patch is attached.
Comment #10
salvisThank you for the report, Jeroen94, and the patch, alan-ps!