Problem/Motivations

Using Drupal 8.3 with simple_sitemap v8.x-2.9 and domain_simple_sitemap v8.x-1.0-beta7, when I enable the module I get this error:

Argument 1 passed to Drupal\domain_simple_sitemap\DomainSimpleSitemapGenerator::generateSitemap() must be of the type array, null given, called in /var/www/docroot/modules/contrib/domain_simple_sitemap/src/Batch/BatchUrlGenerator.php on line 304 and defined DomainSimpleSitemapGenerator.php:116

Proposed Resolution

Do not generate sitemap on install.

Comments

josephdpurcell created an issue. See original summary.

josephdpurcell’s picture

Issue summary: View changes
StatusFileSize
new423 bytes

After digging in, I have some clarity on this issue. Looking at the call stack:

#0 /var/www/docroot/modules/contrib/domain_simple_sitemap/src/DomainSimpleSitemapGenerator.php(285): Drupal\simple_sitemap\Batch\Batch->start()
#1 /var/www/docroot/modules/contrib/domain_simple_sitemap/src/DomainSimpleSitemap.php(132): Drupal\domain_simple_sitemap\DomainSimpleSitemapGenerator->startGeneration()
#2 /var/www/docroot/modules/contrib/domain_simple_sitemap/domain_simple_sitemap.install(26): Drupal\domain_simple_sitemap\DomainSimpleSitemap->generateSitemap('nobatch')

We can conclude that when Drupal\simple_sitemap\Batch\Batch::start() gets called, and it runs the "nobatch" case (see line 80), that this->batch['operations'] is an empty array. Consequently, $context never gets modified, making $context['results'] a NULL value.

I am not certain, without more digging, how the generation should be properly triggered.

I am proposing that on install, the sitemap does not get generated automatically and have attached a patch for this.

josephdpurcell’s picture

Status: Active » Needs review

Setting to needs review.

keopx’s picture

Assigned: Unassigned » keopx

Thanks @josephdpurcell

I am not sure with solution, but probably is good idea not buil sitemap on install process.

Give me time to review this.

  • keopx committed 2b00aa1 on 8.x-1.x authored by josephdpurcell
    Issue #2897372 by josephdpurcell: DomainSimpleSitemapGenerator::...
keopx’s picture

Status: Needs review » Fixed

Thank you @josephdpurcell

Status: Fixed » Closed (fixed)

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