From e61d46ea1eeff4efefbf0abc7ff6957bb2e6fe1d Mon Sep 17 00:00:00 2001 From: alvar0hurtad0 Date: Tue, 3 Jun 2014 17:26:35 +0200 Subject: [PATCH] Issue #2045409 by alvar0hurtad0 | errev: Notice: Undefined offset: 0 in comment_submit() (line 2197 of comment/comment.module) --- modules/comment/comment.module | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 3c94200..049f75f 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -2194,14 +2194,21 @@ function comment_submit($comment) { // 3) Convert entities back to plain-text. $field = field_info_field('comment_body'); $langcode = field_is_translatable('comment', $field) ? entity_language('comment', $comment) : LANGUAGE_NONE; - $comment_body = $comment->comment_body[$langcode][0]; + if (isset($comment->comment_body[$langcode][0])){ + $comment_body = $comment->comment_body[$langcode][0]; + } if (isset($comment_body['format'])) { $comment_text = check_markup($comment_body['value'], $comment_body['format']); } else { - $comment_text = check_plain($comment_body['value']); + /***/ + if(isset($comment_body['value'])){ + $comment_text = check_plain($comment_body['value']); + } + } + if(isset($comment_body['value'])){ + $comment->subject = truncate_utf8(trim(decode_entities(strip_tags($comment_text))), 29, TRUE); } - $comment->subject = truncate_utf8(trim(decode_entities(strip_tags($comment_text))), 29, TRUE); // Edge cases where the comment body is populated only by HTML tags will // require a default subject. if ($comment->subject == '') { -- 1.8.5.2 (Apple Git-48)