Term creation fail with php 8 when override_selector = TRUE

Created on 27 April 2023, over 1 year ago

Problem/Motivation

If I set taxonomy.settings override_selector to true, creation of terms fail in PHP 8.0.

TypeError : array_values(): Argument #1 ($array) must be of type array, null given dans array_values() (/opt/drupal/web/core/modules/taxonomy/src/TermForm.php ligne 120)

TypeError : count(): Argument #1 ($value) must be of type Countable|array, null given dans count() (/opt/drupal/web/core/modules/taxonomy/src/TermForm.php ligne 173)

Steps to reproduce

drush cset taxonomy.settings override_selector 1

I need to set this configuration to true because I have a vocabulary with a huge amount of terms (> 500 000) without tree structure.
If I let this config to false, this leads to memory allocation fatal error in term form.

But when, this config is set to true, the creation of term fails because $form_state->getValue('parent') returns null and in PHP 8.0 array_values and count don't allow null argument (warning in PHP 7.4).

Proposed resolution

see issue 3242538

🐛 Bug report
Status

Postponed: needs info

Version

9.5

Component
Taxonomy 

Last updated 1 day ago

  • Maintained by
  • 🇺🇸United States @xjm
  • 🇬🇧United Kingdom @catch
Created by

🇫🇷France mounir_abid

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

Comments & Activities

Production build 0.71.5 2024