Keep MultiValue.php synchronized with upstream

Created on 5 April 2023, over 1 year ago
Updated 12 July 2024, 6 months ago

What the title says.

Original report:

Problem/Motivation

In the configuration form (/admin/config/people/saml), when save the form. The following PHP warning message occured.

Warning: Undefined array key "#default_value" in Drupal\samlauth\Element\MultiValue::processMultiValue() (line 190 of modules/contrib/samlauth/src/Element/MultiValue.php).

Steps to reproduce

  1. Install this module in a Drupal 10 website which is running with PHP 8.1
  2. Go to the configuration form (/admin/config/people/saml)>/li>
  3. Fill in all mandatory fields in the form.
  4. Save the form.

Proposed resolution

Change the line at 190 in src/Element/MultiValue.php
from

if (!$element['#default_value'] && isset($element['#add_empty']) && $element['#add_empty'] === FALSE) {

to

if (empty($element['#default_value']) && isset($element['#add_empty']) && $element['#add_empty'] === FALSE) {
🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇦🇺Australia mingsong 🇦🇺

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024