Follow up on #1009234: Notices on line 118 of Bayesian filter was talked a lot about the one problem in the Bayesian filter.

The following are E_NOTICE errors I got when marking a spam comment as spam in the comments approval queue.

    * notice: Undefined index: score in .../drupal/sites/all/modules/spam/spam.module on line 1729.
    * notice: Undefined variable: extra in .../drupal/sites/all/modules/spam/content/spam_content_comment.inc on line 217.
    * notice: Undefined index: tokens in .../drupal/sites/all/modules/spam/filters/spam_filter_bayesian/spam_filter_bayesian.module on line 182.
    * notice: Undefined index: gzcjzmfemqbu.com in .../drupal/sites/all/modules/spam/filters/spam_filter_url/spam_filter_url.module on line 176.
    * notice: Undefined index: total in .../drupal/sites/all/modules/spam/filters/spam_filter_url/spam_filter_url.module on line 177.
    * notice: Undefined index: sxcoifylsmzg.com in .../drupal/sites/all/modules/spam/filters/spam_filter_url/spam_filter_url.module on line 176.
    * notice: Undefined index: qtxemrxrunqc.com in .../drupal/sites/all/modules/spam/filters/spam_filter_url/spam_filter_url.module on line 176.
    * notice: Undefined index: vhjilbolhptn.com in .../drupal/sites/all/modules/spam/filters/spam_filter_url/spam_filter_url.module on line 176.
    * notice: Undefined index: redirect in .../drupal/sites/all/modules/spam/spam.module on line 1751.
    * notice: Undefined index: comments in .../drupal/sites/all/modules/spam/content/spam_content_comment.inc on line 274.

Thank you.
Alexis Wilke

Comments

killes@www.drop.org’s picture

Status: Active » Postponed (maintainer needs more info)

Not seeing this.

AlexisWilke’s picture

Status: Postponed (maintainer needs more info) » Active

Fix for the URL filter:
http://drupalcode.org/project/spam.git/commit/5507a15

It would do this:

$a = array();
$a['some URL']++;

The ++ accesses an undefined entry the first time the URL is found.

Thank you.
Alexis Wilke

AlexisWilke’s picture

Fix for the 'redirect' index:
http://drupalcode.org/project/spam.git/commit/51e1bd5

Somehow all the other parameters used were checked with isset() but not 'redirect'...

Thank you.
Alexis Wilke

AlexisWilke’s picture

Assigned: Unassigned » AlexisWilke
Status: Active » Fixed
Issue tags: +E_NOTICE errors

Fixed the comment notice:
http://drupalcode.org/project/spam.git/commit/0c66a1c

The same function is used whether it is creating the Comment form with the list of comments or whether it is checking the posted data. In the former the form does not include the $form_state['post']['comments'] which needs to be checked with isset() and not is_array(). (we could also check with empty() and avoid the loop when empty...)

Thank you.
Alexis Wilke

P.S. marking as fixed. The first 3 notices posted here were already gone in 6.x-1.x including the latest killes check-ins (but it probably was fixed from before killes latest changes.)

Status: Fixed » Closed (fixed)
Issue tags: -E_NOTICE errors

Automatically closed -- issue fixed for 2 weeks with no activity.