Fix warning on unexpected paths

Created on 6 March 2013, about 12 years ago
Updated 25 March 2025, 24 days ago

Paths like "comment/abc" (i.e., with a string in place of the comment ID) result in:

  • Notice: Trying to get property of non-object in commentaccess_access_check() (line 393 of commentaccess.module).
  • Notice: Trying to get property of non-object in commentaccess_access_check() (line 402 of commentaccess.module).
  • Notice: Trying to get property of non-object in commentaccess_access_check() (line 405 of commentaccess.module).

Of course, this doesn't affect the module functionality, but the access checks should validate input.

This can be solved in several ways: for example, by testing that $comment->nid is valid just before using it, see attached patch.

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇹Italy pescetti

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024