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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeroen94 created an issue. See original summary.

cilefen’s picture

Category: Bug report » Support request
Issue tags: -comment, -node, -error message, -undefined variable

Please show us your code.

Jeroen94’s picture

Category: Support request » Bug report
Issue summary: View changes
Issue tags: +comment, +node, +error message, +undefined variable

These 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.

cilefen’s picture

I 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.

When I render a node comment with the Devel module

What exactly do you mean by that?

Jeroen94’s picture

FileSize
5.88 KB
10.42 KB
75.35 KB

Okay, @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:

  1. Create a new Drupal website, install and enable the Devel module.
  2. Create an Article and a comment on that node.
  3. Render the comment with Devel by following the screenshots underneath.

Step 1:
Step 1

Step 2:
Step 2

Step 3:
Step 3

longwave’s picture

Issue tags: -comment, -node, -error message, -undefined variable, -Needs steps to reproduce

"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.

Before adding tags read the issue tag guidelines. Do NOT use tags for adding random keywords or duplicating any other fields. Separate terms with a comma, not a space.

I removed the random keywords again.

Jeroen94’s picture

Project: Drupal core » Devel
Version: 7.39 » 7.x-1.5
Component: comment.module » devel

Thanks 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.

alan-ps’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
638 bytes

The 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.

  • salvis committed 0cb3c81 on 7.x-1.x
    Issue #2561457 by alan-ps, Jeroen94: Undefined variable "node" in...
salvis’s picture

Title: Undefined variable "node" in comment_view(). » Undefined variable "node" in comment_view() on comment/%/devel/render
Status: Needs review » Fixed

Thank you for the report, Jeroen94, and the patch, alan-ps!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.