Upon initial installation I immediately get the following errors on a page load:

Notice: Undefined index: body in antispam_comment_presave() (line 1012 of all/modules/antispam/antispam.module).
Notice: Undefined index: mail in antispam_comment_presave() (line 1007 of all/modules/antispam/antispam.module).
Notice: Undefined index: ip   in antispam_comment_presave() (line 1002 of all/modules/antispam/antispam.module).
Notice: Undefined index: body in antispam_comment_presave() (line 996 of all/modules/antispam/antispam.module).
CommentFileSizeAuthor
#2 antispam.module.patch1.57 KBReg
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Reg’s picture

Oops, I miss-spoke, not upon page load but on creating a comment.

Reg’s picture

FileSize
1.57 KB

Here's a patch to get rid of the notices.

shabam’s picture

Version: 7.x-1.1 » 7.x-1.5

I am getting this same error with the newest (1.5) version. I applied the patch (manually) and it works now.

Jason

Jody Lynn’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Active » Needs review

This could use another confirmation/review.

tim.plunkett’s picture

Status: Needs review » Needs work

The !empty() didn't need to be added in addition to the original condition, it just need to replace it.

+++ b/www/cms/sites/all/modules/antispam/antispam.moduleundefined
@@ -992,23 +992,23 @@ function antispam_comment_presave($comment) {
-  if ($antispambot_rules['body']) {
+  if (!empty($antispambot_rules) && $antispambot_rules['body']) {

For example this should just be
if (!empty($antispambot_rules)) {

  • cfinke committed f9b8d90 on 7.x-1.x
    Issue #1389748 by Reg: Multiple "Undefined index" notices
    
cfinke’s picture

Issue summary: View changes
Status: Needs work » Fixed
colan’s picture

@cfinke: One thing to note:

  • cfinke committed d9ca240 on 7.x-1.x
    Issue #1389748 by Reg: Multiple "Undefined index" notices
    
    Reverting...

  • cfinke committed c0bd825 on 7.x-1.x
    Issue #1389748 by Reg, tim.plunkett: Multiple "Undefined index" notices...
colan’s picture

Still missing --author tag though?

cfinke’s picture

The Drupal "commit messages" page says this about giving credit:

If others have contributed to the change you are committing, take the time to give them credit. Each commit message should contain at least one contributor name, even if it refers to yourself. Once a project has more than one maintainer, or is taken over by a new maintainer, it's very valuable to know who actually wrote or contributed a certain change.

To do this, append "by [username]:" to the issue number.

Is that not sufficient?

colan’s picture

That's great for humans, but for drupal.org to automatically credit authors so that commits show up in their profile, maintainers need to use the --author option when committing. This is noteworthy from the link above:

The Credit & committing section of an issue will automatically format commit messages for you, including --author attribution, so that you can just edit the message (it defaults to the issue title) as needed.

This is pre-filled based on whoever submitted the last patch, but you may want to change it by selecting a different radio button if someone did more work in a previous patch, and you want to make him/her the author.

tim.plunkett’s picture

The --author flag does not control what shows up in the profiles. That would be the "credit" checkboxes, which are currently blank for this issue.

The project maintainer can select those checkboxes, and hit save.
No need to change the commit any futher.

colan’s picture

#14: Correct! I forgot about that option because it's newer.

Status: Fixed » Closed (fixed)

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