Social private message: EntityReferenceAutocompleteWidget::massageFormValues(): Argument #1 ($values) must be of type array, null given

Created on 7 June 2024, 7 months ago
Updated 25 June 2024, 6 months ago

Problem/Motivation

Trying to send a message to myself displays an error on screen:

TypeError: Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::massageFormValues(): Argument #1 ($values) must be of type array, null given, called in /home/ce-dev/deploy/live.local/web/core/lib/Drupal/Core/Field/WidgetBase.php on line 505 in Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget->massageFormValues() (line 149 of core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php).

Problem is located here:

open_social/modules/social_features/social_private_message/src/Element/SocialPrivateMessageEntityAutocomplete.php

After:

parent::validateEntityAutocomplete($element, $form_state, $complete_form);
$value = $form_state->getValue('members');
$form_state->setValue('members', $value['target_id']);

It assume $value['target_id'] will have always a valid id, but the parent call can return NULL.

🐛 Bug report
Status

Needs review

Version

12.4

Component

Private messages

Created by

🇪🇸Spain dioni

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