Drupal Fatal Error: Unsupported operand types in common.inc on line 2984

Drupal

After updating a Drupal site to version 6.24 from 6.22 I started receiving this error during cron runs:
Fatal Error: Unsupported operand types in common.inc on line 2984

I added the following debug text to common.inc to track down the error:

  if (!is_array($elements)) {
    print_r($elements);
    print "\n--------------\n";
    $backtrace = debug_backtrace();
    var_export($backtrace);
    die();
  }

Looking at the stack trace I could see that the issue was with the search module indexing the site.
The issue was only occurring for a particular node type. If I deleted all of the nodes for that type everything ran fine.
After much debugging and database backup / restoring I still couldn't find why this particular node type was having an issue indexing.
I deleted the node type completely and created a new content type and as soon as I created a node of the new type Boom, cron failed with the same problem when indexing. Scratching my head I disabled several modules and still the problem persisted.

Finally I deleted the search index and re-ran cron. This time cron failed for a different reason. I was running cron directly from the command line, so I tried running it manually from the site and it ran fine. I ran from the command line again and this time everything worked.

I was pretty sure that it was only working because the search only indexes 100-500 nodes at a time and that as soon as it started trying to index the new content type nodes it would fail again, so I set cron to run every 15 seconds via watch:

watch -n 15 php cron.php

I came back a while later and to my surprise the site was 100% indexed and cron was still running fine.

I am baffled but the next time I run into an issue where cron is failing due to search indexing my first steps will be to dump the index and re-index the site.

I hope this saves someone from the hours of frustration I just went through.


Comments
(Thanks to everyone who comments)

Post new comment

More information about formatting options