I am currently getting

Notice: Undefined offset: 0 in antispam_get_moderator_types() (line 1227 of /var/www/pressflow/sites/all/modules/antispam/antispam.module).

on all of my pages I am using current version of pressflow, with memcache and varnish installed. I installed the module via drush. I am using the Typepad API for spam filtering. If it is as simple as modifing some PHP code or if you know how to disable the error from displaying I can put the code in myself until a fix is released if that is the actual problem.

Comments

pixture’s picture

This is not a bug but a runtime notice from PHP. You can suppress the notice message from appearing by changing PHP setting (php.ini) file.

error_reporting = E_ALL & ~E_NOTICE

If you can not do this, then add code to antispam_get_moderator_types() function.

Before

function antispam_get_moderator_types($account = NULL) {
  global $user;
  static $node_types = FALSE;
  static $moderator_types = array();

  if (is_null($account)) {
    $account = $user;
  }

After

function antispam_get_moderator_types($account = NULL) {
  global $user;
  static $node_types = FALSE;
  static $moderator_types = array();

  if (is_null($account)) {
    $account = $user;
  }
  if (!$account->uid) {
    return $moderator_types;
  }

I guess this will do it.

ultrabizwebnet’s picture

Thanks for the prompt reply I edited the php.ini file as you suggested and it took away the errors.

Konstantin Boyandin’s picture

Note: I have PHP warnings turned off, but the above message is still being printed.

My opinion is that correct code should NOT access non-existing indices, and the correct line 1227 could look like

return isset($moderator_types[$account->uid]) ? $moderator_types[$account->uid] : NULL;
Kutakizukari’s picture

I have the same settings as ultrabizwebnet, Pressflow and the Typepad API for spam filtering. I don't have memcache and varnish installed yet but returning the same error in the log file.

Notice: Undefined index: 0 in antispam_get_moderator_types() (line 1227 of /path/to/drupal_root/sites/all/modules/antispam/antispam.module).

I turned off the errors from writing to screen by going to:

http://mysite.com/admin/settings/error-reporting

or

Administer / Site Configuration / Error Reporting

and under "Error Reporting" select "Write errors to the log" in the drop-down box.

Hope this helps!

avpaderno’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
Issue summary: View changes
Status: Active » Closed (outdated)

I am closing this issue, since Drupal 4.x, 5.x, and 6.x are now not supported.