I have Message and Commerce Message installed and working fine. However, on our dev site, when trying to run cron, it throws this error and stops cron from finishing:

PHP Fatal error: Unsupported operand types in /home/devel/public_html/sites/all/modules/message/message.module on line 295

That line and the function is:

  // Gather purgeable messages of overriding types.
  foreach ($override_types as $message_type) {
    // Ignore message type with unchecked "Purge messages". Also make sure that
    // purging settings are present.
    if (empty($message_type->data['purge']) || empty($message_type->data['purge']['enabled'])) {
      continue;
    }

    $purge_messages += message_get_purgeable_by_type($purge_limit, $message_type->name, $message_type->data['purge']); //Line 295
  }

I think this might be caused by checking "Override" and "Purge Messages", but not putting anything in the field. In that case, it does not return an array.

function message_get_purgeable_by_type(&$purge_limit, $message_type_name, $purge_settings) {
  if ($purge_limit <= 0) {
    return;
  }

...
..

If you change it to:

function message_get_purgeable_by_type(&$purge_limit, $message_type_name, $purge_settings) {
  if ($purge_limit <= 0) {
    return array();
  }

...
..

It seems to work fine.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

How about a patch? :)

antondavidsen’s picture

Patch against 1.9

amitaibu’s picture

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

Correct status and version.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

That seams reasonable in #2 if we are to union the array we better expect the operands to be as much.

Delphine Lepers’s picture

Any chance to get this patch included in the next release?

jonhy81’s picture

+1 to include this patch in the next release.

nikolabintev’s picture

#2 works for me. It fixes the issue. Please commit it to the next release

bluegeek9’s picture

Status: Reviewed & tested by the community » Closed (outdated)