Hello,

I had xmlsitemap 6.x-2.0-alpha2 on one of my websites. Today, I updated to the latest dev of xml sitemap (2010-Apr-19) and installed domain xml sitemap.

Now, everytime cron runs, I get lots of these errors:

warning: Invalid argument supplied for foreach() in /home/.../sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module on line 332.

And the xmlsitemap is not there any more (error 404 when calling the page).

===

I have an older dev version of xml sitemap from the time I started testing domain xml sitemap:

from xmlsitemap.info
; $Id: xmlsitemap.info,v 1.2.2.4.2.21 2010/04/07 22:39:10 davereid Exp $
..
; Information added by drupal.org packaging script on 2010-04-08
version = "6.x-2.x-dev"
core = "6.x"
project = "xmlsitemap"
datestamp = "1270729799"

I tested this version again and it does not have this problem. So the source of the error message must be something that you have done in one of your newer dev versions.

Well I switched to the old dev again for the time being...

Comments

dave reid’s picture

Status: Active » Fixed

Thanks for reporting this. I actually could duplicate this from qa.drupal.org and I think I just fixed it in CVS. Please feel free to give it a try and report back if it is not fixed.

zuzu83’s picture

Status: Fixed » Active

sorry,

I have same preobleme after update 20 april
warning: Invalid argument supplied for foreach() in .../sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module on line 333.

Anonymous’s picture

Did you run update.php or at least clear your caches?

MJH’s picture

I can confirm that the problem is still there in 6.x-2.x-dev (2010-Apr-20).

I ran update.php and cleared my caches.

Interesting point: The error message now says that the problem is on line 333 (using the dev of 2010-Apr-19, it was on line 332).

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

Hmm, I'm running the latest 6.x-2.x-dev now on my actual blog without problem. I can't confirm this. You might have to help me out by inserting some debugging statements around those lines to figure out what exactly is going wrong.

dave reid’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ok I found a bug in the node_access() function I copied. I committed a fix to CVS that should help clear things up.
http://drupal.org/cvs?commit=360748

I'll keep testing and re-open if anyone can reconfirm with more error details after the dev build is regenerated.

dave reid’s picture

GAH. I found another bug. I'm very confident that I've actually fixed this for good now. I've do so much manual testing and I'm working on adding several tests to make sure I don't ever break this again.

srobert72’s picture

#783402: Won't Index Nodes or Taxonomy has been marked duplicate of this issue

skizzo’s picture

I just installed 6.x-2.x-dev (packaging script on 2010-04-29) plus domain_xmlsitemap 6.x-1.0-alpha1. I have enabled xmlsitemap_node only. Maps are ok, but I am seeing a bunch of repeated warnings (at line 333) on rebuild

warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module on line 333.

dave reid’s picture

Status: Fixed » Postponed (maintainer needs more info)

@skizzo: Can you add this line of code below line 327 in xmlsitemap_node.module:
drupal_set_message(var_export($grants[$account->uid][$op], TRUE));

Please copy/paste the output of that message on your rebuilds here.

dave reid’s picture

Actually the better code to put in place would be the following around line 331 instead of the above change. Should be pretty clear what section of code this replaces in the file.

      $grant_condition = array();
      if (!is_array($grants[$account->uid][$op])) { drupal_set_message(var_export($grants[$account->uid][$op])); }
      foreach ($grants[$account->uid][$op] as $realm => $gids) {
        if (!is_array($gids)) { drupal_set_message(var_export($gids, TRUE)); }
        foreach ($gids as $gid) {
          $grant_condition[] = "(gid = $gid AND realm = '$realm')";
        }
      }
      if (count($grant_condition)) {
        $grant_condition = 'AND ('. implode(' OR ', $grant_condition) .')';
      }
      else {
        $grant_condition = '';
      }
skizzo’s picture

Here you go... If needed, feel free to provide more debug instructions. Thank you.

An error has occurred.
Please continue to the error page

An error occurred. /en/batch?id=334&op=do (no information available).

the error page:

warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module on line 333.
[....]

333: foreach ($grants[$account->uid][$op] as $realm => $gids) {

skizzo’s picture

After upgrading both xmlsitemap and domain_xmlsitemap to 6.x-2.0-beta1 I am not seeing the warning anymore. Thank you.

dave reid’s picture

Status: Postponed (maintainer needs more info) » Fixed

@skizzo: Woot, thanks for reporting back. :)

Status: Fixed » Closed (fixed)

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