Hi,

since installing the Google-sitemap-module and upgrading poormanscron-module to cvs I'm getting a few of the following warnings in the drupal log lately:

"Invalid argument supplied for foreach() in [...]/modules/poormanscron/poormanscron.module in Zeile 67."

Host is always GoogleBot (66.249.66.105), but it happens very irregularly.
The directory is /gsitemap, but it doesn't matter if the content of my site has changed or not...

Note sure if this is poormanscron's fault, or the sitemap-module...

Comments

Merlin Abraxas’s picture

Hmmm ... maybe too complicated thinking ...

Don't get me wrong, it is a great module!

After the study of cron.php I took all 'message' related lines out and poormanscron-module is working fine since - better without the nasty error messages in the log file.

I'm watching the log carefully and I can't see any impact on other modules after my code change on poormanscron-module.

;-)

oNyx’s picture

Looks like a simple isset() check prior to rebuilding the messages helps (end of poormanscron_exit()). And it should be fine if you dont restore the messages if there arent any messages to begin with.

    // Restore any prior messages.
    if(isset($saved_messages)) {
      foreach ($saved_messages AS $type => $types_messages) {
        foreach ($types_messages AS $message) {
          drupal_set_message($message, $type);
        }
      }
    }

I verfied this somewhat blind guess by changing the watchdog message to this:
watchdog('regular', 'Cron run completed ('.isset($saved_messages).').',WATCHDOG_NOTICE);

If the newsfeed is requested by some anonymous user the message is "Cron run completed()" otherwise its "Cron run completed(1)". So, yea... it might happen that the variable $saved_messages is NULL, which in turn causes that php error message.

HTH :)

Uwe Hermann’s picture

Status: Active » Fixed

Fixed in HEAD and 4-6 (tarballs will be rebuilt in a few hours). Please reopen if there are problems.

florre’s picture

looks good :-)

Uwe Hermann’s picture

Status: Fixed » Closed (fixed)