Posted by doq on April 28, 2006 at 8:29pm
| Project: | Drupal core |
| Version: | 4.7.x-dev |
| Component: | comment.module |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Zen |
| Status: | closed (fixed) |
Issue Summary
I' m using a smiley module. I have entered ':)' as comment body. After all filters are done, ':)' will be replaced with
<?php
<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.
<?php
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.
Comments
#1
Critical?
Sorry, I don't think so.
#2
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
#3
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.
#4
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#5
No, not
<p>...</p>, but<p></p>.#6
If we post
<p></p>text aftermore more moremore more
We get a title
text after more moreIt'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
#7
@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
#8
Patch attached.
-K
#9
Patch attached.
-K
#10
moving
#11
Committed a slightly different patch to head, using
t('No subject')instead of message_na(), which was removed.#12
backported
#13