WSOD on admin/modules if description is set but is NULL in module.info.yml

Created on 22 May 2016, about 8 years ago
Updated 24 July 2023, 11 months ago

Problem/Motivation

I created a custom module with a blank "description" in the modules .info.yml file.

Trying to visit the Extend / module list page shows "The website encountered an unexpected error. Please try again later." and an error in the Watchdog log:

InvalidArgumentException: $string ("") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 140 of core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php)

The problem originates at line 209 in core/modules/system/src/Form/ModulesListForm.php

    $row['description']['#markup'] = $this->t($module->info['description']);

Proposed solution is to test for $module-info['description']):

    $row['description']['#markup'] = $this->t(isset($module->info['description']) ? $module->info['description'] : '');

There might be a better way, e.g. to highlight the missing description before we get to this point, or disable the module. According to https://www.drupal.org/node/2000204 β†’ the description should be required/mandatory.

Steps to reproduce

To reproduce, create an empty module with just a module info.yml as shown below, and visit the Extend page.

name : emptytest
description :
type: module
core : 8.x

Proposed resolution

See suggestion in #23 πŸ› WSOD on admin/modules if description is set but is NULL in module.info.yml Fixed

Remaining tasks

Agree on the solution
patch with test
review
commit

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.1 ✨

Component
SystemΒ  β†’

Last updated 1 day ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom versantus.nik

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024