TypeError: _xmlsitemap_element_add_alternate_lang(): Argument #3 ($language) must be of type Drupal\Core\Language\LanguageInterface, null given

Created on 19 February 2023, almost 2 years ago
Updated 20 June 2024, 5 months ago

Problem/Motivation

Found a massive log of this every time cron is attempting to run and this persistently logging due to failed cron.

TypeError: _xmlsitemap_element_add_alternate_lang(): Argument #3 ($language) must be of type Drupal\Core\Language\LanguageInterface, null given, called in /myapplication/web/modules/contrib/xmlsitemap/xmlsitemap.module on line 1874 in _xmlsitemap_element_add_alternate_lang() (line 1893 of /myapplication/web/modules/contrib/xmlsitemap/xmlsitemap.module)

I have checked default language is set to "en". I have also checked in the database xmlsitemap table, no data their that has null value for "language" either. Any idea?

Steps to reproduce

Drupal 9.4.8
Xmlsitemap 1.4
Enable drupal cron

Proposed resolution

Temporary solution: added a check if "xmlsitemap_language_load($language_link['language'])" has a value.

🐛 Bug report
Status

Needs review

Version

1.4

Component

xmlsitemap.module

Created by

🇳🇿New Zealand janpongos

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

Comments & Activities

Production build 0.71.5 2024