TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 500 of xmlsitemap/xmlsitemap.generate.inc).#0

Created on 4 June 2025, about 2 months ago

Problem/Motivation

When running drush xmlsitemap-rebuild on a large site I get this error:

Undefined array key "node" xmlsitemap.generate.inc:500
WD php: TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 500 of /var/www/site/docroot/profiles/recruiter/modules/xmlsitemap/xmlsitemap.generate.inc).#0
/var/www/site/docroot/profiles/recruiter/modules/xmlsitemap/xmlsitemap.generate.inc(500): array_keys(NULL)
#1 /var/www/site/docroot/includes/batch.inc(243): xmlsitemap_rebuild_batch_fetch('node', Array)

This probably happens because the count of nodes changed while the sitemap rebuild is running. Then there are no further nodes to process and we should stop.

Steps to reproduce

Run drush xmlsitemap-rebuild on a large site while nodes get deleted.

Proposed resolution

Check for empty results.

Remaining tasks

Merge request

User interface changes

none

API changes

none

Data model changes

none

πŸ› Bug report
Status

Active

Version

2.0

Component

xmlsitemap.module

Created by

πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024