Warnings when using non-standard comment field formatter

Created on 23 May 2023, about 1 year ago
Updated 25 May 2023, about 1 year ago

Problem/Motivation

I created a comment field formatter that doesn't load and render the whole comment thread, but when using it warnings are generated:

Warning: Undefined array key "comments" in comment_preprocess_field() (line 724 of core/modules/comment/comment.module). 

Steps to reproduce

Create a comment field formatter that doesn't provide the comments or comment_form variable to the field template.

Proposed resolution

Add checks to comment_preprocess_field to make sure the array indexes it's accessing actually exist.

πŸ› Bug report
Status

Needs work

Version

9.5

Component
CommentΒ  β†’

Last updated 2 days ago

Created by

πŸ‡§πŸ‡ͺBelgium DieterHolvoet Brussels

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024