I noticed today that the variables in the spam module (main module) were at times named "spam_filter_..." In other words, such a variable could happen to be the exact same as a spam filter variable.

Especially, the usage in the node content shows spam_filter_+<node type> which, if the node type happens to be, say, "bayesian_default_probability", will clash with the variable of the same name in the Bayesian module. Although it is unlikely that someone would name a type the same as one of the filter variables, it is a possibility that should not be relied on.

For the node content, I would suggest renaming the variable "spam_node_...", but we'd have to look at all of them. I do not think that the top spam module should ever use "spam_filter_..." since that may clash with any one filter.

I think that the main two entries that can cause problems are the following:

  variable_get("spam_filter_$arg1->type", 0)
  '#default_value' => variable_get("spam_filter_$name", (int)$content_type['default_value'])

There are a few more such as spam_filter_users and spam_filter_comments. And as far as I know, users & comments are not filters.

Thank you.
Alexis Wilke

Comments

gnassar’s picture

You are correct. Each of those spam_filter_* variables you mention should be spam_content_* instead.

-- Also, while we're looking at it... the line you mention needing changing in _comment.inc:

return (variable_get('spam_filter_comments', 1));

with the spam_filter_comments that needs to be changed to spam_content_comments -- pretty sure the default variable_get value be 0, not 1.

Jeremy’s picture

> pretty sure the default variable_get value be 0, not 1

All versions of the spam module have filtered comments by default up to now, as this has always been the most common form of comment spam. If you change that default, you should document the change somewhere, and at which point the spam module would be totally disabled by default when first installed...