$links variable can be undefined when only one language present

Created on 24 February 2023, almost 2 years ago
Updated 16 March 2023, almost 2 years ago

We removed all extra languages from a Drupal website and want to keep the dropdown in place for a new language which will be added in the future.

This leads to the following error:

Warning: Undefined variable $links in modules/contrib/dropdown_language/src/Plugin/Block/DropdownLanguage.php on line 245
The website encountered an unexpected error. Please try again later.
TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 245 of modules/contrib/dropdown_language/src/Plugin/Block/DropdownLanguage.php).

The attached patch fixes this.

🐛 Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

🇳🇱Netherlands Ruuds

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

Comments & Activities

Production build 0.71.5 2024