I' m using a smiley module. I have entered ':)' as comment body. After all filters are done, ':)' will be replaced with

<p><img class="smiley" src="/emoticon/smile.gif" width="24" height="24" title="Smiling" alt="Smiling" /></p>

Nice.

And the following code will make us a zero-length code due to strip_tags magic.

  if (trim($form_values['subject']) == '') {
    // The body may be in any format, so we:
    // 1) Filter it into HTML
    // 2) Strip out all HTML tags
    // 3) Convert entities back to plain-text.
  // Note: format is checked by check_markup().
    $form_values['subject'] = truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE);
  }
  return $form_values;
}

Well. I know you can say - its smileys issue. But I think ot only smiley, even some full-working module can break Drupal functionality in such a way.

The solution: the best I think is to ask user to enter a comment title, 'cos it can't be automattically generated.

CommentFileSizeAuthor
#9 comment_subject_0.patch1.13 KBZen
#8 comment_subject.patch1.13 KBZen

Comments

webchick’s picture

Priority: Critical » Minor

Critical?

Sorry, I don't think so.

Zen’s picture

Category: bug » feature

This is a module issue or you can make a feature request to have a "required" option in the comment configuration page for comment subjects (which would be nice).

Marking as a feature request.

Thanks
-K

doq’s picture

Version: 4.7.0-rc4 » 4.7.0
Category: feature » bug
Priority: Minor » Normal

try to post <p></p> and you'll see comment with no title. No external modules, just default input format.
I can develop patch if anybody interesting in fixing this.

magico’s picture

Version: 4.7.0 » 4.7.3
Status: Active » Fixed

I posted the following comment

<p>this should create a title</p>
more text more text more text more text

It generates the following title: this should create a

webchick’s picture

Status: Fixed » Active

No, not <p>...</p>, but <p></p>.

magico’s picture

If we post

<p></p>text after
more more moremore more

We get a title text after more more

It's normal that if we only put some empty tags in HTML they will not show up. If we do not want to allow these kind of posts then look here http://drupal.org/node/67348

Zen’s picture

Priority: Normal » Minor

@doq: Please submit a patch for this (that validates the subject rather than make the subject mandatory) - thanks :) I'll be happy to review it.

Cheers,
-K

Zen’s picture

Title: Comment title might be not generated automatically » Comment subject is calculated incorrectly when the comment text contains only HTML tags
Version: 4.7.3 » 4.7.4
Assigned: Unassigned » Zen
Status: Active » Needs review
StatusFileSize
new1.13 KB

Patch attached.

-K

Zen’s picture

StatusFileSize
new1.13 KB

Patch attached.

-K

killes@www.drop.org’s picture

Version: 4.7.4 » 5.x-dev

moving

Steven’s picture

Status: Needs review » Patch (to be ported)

Committed a slightly different patch to head, using t('No subject') instead of message_na(), which was removed.

killes@www.drop.org’s picture

Version: 5.x-dev » 4.7.x-dev
Status: Patch (to be ported) » Fixed

backported

Anonymous’s picture

Status: Fixed » Closed (fixed)