Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hey!
Whenever i clear cache with drush cc all or run cron, I get the following error message:
Warning: Invalid argument supplied for foreach() in xmlsitemap_get_link_type_enabled_bundles() (line 966 of /public_html/sites/all/modules/contrib/xmlsitemap/xmlsitemap.module).
What could be the reason for this?
Comment | File | Size | Author |
---|
Comments
Comment #1
farald CreditAttribution: farald commentedIf
xmlsitemap_get_link_info($entity_type);
returns null, we have this error.
First of all, can this happen in normal circumstances?
If yes, wrapping xmlsitemap_get_link_type_enabled_bundles()'s foreach in
if(empty($info)){}
would remove it.
Comment #1.0
farald CreditAttribution: farald commentedMinor change
Comment #2
killtheliterate CreditAttribution: killtheliterate commentedI made a little patch for this, if it's not already take care of — just checking that $info isn't null before doing the loop.
Comment #3
kenorb CreditAttribution: kenorb commentedComment #4
thechanceg CreditAttribution: thechanceg commentedWhile I was not able to reproduce your error; I do see how that function could possibly return NULL. Seems sensible to have the check in place, I just made it one line. If not for that I would have just set it to R&TBC.
Comment #5
Chris Matthews CreditAttribution: Chris Matthews commentedThe 3 year old patch in #4 to xmlsitemap.module does not apply to the latest xmlsitemap 7.x-2.x-dev and if still applicable needs a reroll.