Sorry for my bad English. After I deleted the comment body field in the field configuration page (I use this type of comment for special usage so it doesn't need a body), I found that for every comment, when I save it there's an error message like:
"Notice: Undefined property: stdClass::$comment_body in comment_submit() (line 2180)"
I know maybe this is a pretty minor issue since it's not very common and can be solved by turning of displaying notice level error message in php, but I'll still post the patch in case anyone have the same issue and would like to fix it.

Cheers,
Andy

Comments

andyhu’s picture

Status: Active » Needs review
sanchi.girotra’s picture

StatusFileSize
new46.5 KB

Andy,
I did the same thing that you mentioned but have't got any error.
Please find the attached file.

devin carlson’s picture

Title: Comment module should not generate the notice error message when the comment body field is deleted » Error notice when posting a comment after the comment body field is deleted
Priority: Minor » Major
StatusFileSize
new929 bytes
new3.66 KB

I've also been able to duplicate this.

The comment module assumes that a comment will have a body field in a couple of places: once in the comment submit function to try and generate a comment subject from the body field and once on the administration page to add title text to links.

The attached patch adds a check to ensure that the body field is available before attempting to use it and also adds a test which deletes the comment body field from the article content type and then attempts to post a comment.

I'll forward-port the patches to D8 if these come back green+red.

Status: Needs review » Needs work

The last submitted patch, remove-comment-body-requirement-test-1596166-3.patch, failed testing.

devin carlson’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.05 KB
new3.88 KB

And the same changes for D8.

Status: Needs review » Needs work

The last submitted patch, remove-comment-body-requirement-test-1596166-4.patch, failed testing.

devin carlson’s picture