When posting comments, I get this error message:

Notice: Undefined index: format in comment_submit() (line 2161 of /.../modules/comment/comment.module).

In each instance the comment does publish, but the error message also appears. Here are the parameters for when the message appears:
- the message appears if a comment title is not allowed
- the message appears if a comment title is allowed, but the field is left blank when the comment is submitted
- the message does not appear if the comment fields are set to filtered text (in the above cases the fields were set to plain text)

Also, this error message may be related and appears when the admin views the comments page for all site comments:

Notice: Undefined index: und in comment_admin_overview() (line 107 of /.../modules/comment/comment.admin.inc).

I'm stumped on how to solve this issue.

Comments

nuez’s picture

I can confirm this issue, tried it on a clean install.

lyricnz’s picture

Status: Active » Needs review
StatusFileSize
new1013 bytes

I can reproduce your first issue. It's caused by the code assuming that a comment-format is set, when this is not set when using plain text. I have added a check for this. I cannot reproduce your second issue - can you describe more about how to reproduce? Do you have multiple languages configured?

nuez’s picture

OK the patch works for the first issue works, thanks.

wcarpent’s picture

Which issue are you referring to as the second issue?

lyricnz’s picture

The second issue was:

"Also, this error message may be related and appears when the admin views the comments page for all site comments:
Notice: Undefined index: und in comment_admin_overview() (line 107 of /.../modules/comment/comment.admin.inc)."

I am unable to reproduce this.

If you test and verify the patch above - please change the status of this issue to "reviewed & tested by the community"

lyricnz’s picture

Bump. Please review. #4 was question from third-party.

adamwhite’s picture

I have also tested and the patch works for me.

HedgeMage’s picture

I wasn't able to reproduce the problem :(

davidhernandez’s picture

I am also unable to reproduce the error, in any of the outlined cases.

lyricnz’s picture

StatusFileSize
new103.93 KB

From a clean install:
- ensure comment module enabled
- change "text processing" on article /admin/structure/types/manage/article/comment/fields/comment_body to plain text
- create an article
- post a comment on that article, with no subject (it's optional)

See attachment.

davidhernandez’s picture

Thanks, Simon. Those steps worked. Using the steps in #10, I can confirm the patch fixes the error in that case. As posted in #5, I cannot replicate an error on the main comments page.

geerlingguy’s picture

Version: 7.2 » 7.x-dev

We should probably mark this issue as a duplicate of #813052: Undefined index: format in comment_preview line 2065 and line 2183 (which existed prior to this issue), and follow up with the patch there (or we could move discussion into this thread). It's the same bug...

Additionally, patches should go against -dev.

lyricnz’s picture

Status: Needs review » Closed (duplicate)