Error if no default value have been set to the field reaction

Created on 27 August 2023, about 1 year ago
Updated 17 May 2024, 6 months ago

Problem/Motivation

Drupal 10.1.2
PHP 8.1.14
If no default value have been set on the field reaction, an error is throw on the add form of the entity.

Steps to reproduce

Add a reaction field on an entity with no default value set (media image in my case)
Add a new media
An error should appear "Warning: Trying to access array offset on value of type null in /var/www/docroot/modules/contrib/votingapi_reaction/src/Plugin/Field/FieldWidget/VotingApiReactionWidget.php on line 113"

Proposed resolution

Add a condition to check if the method $this->fieldDefinition->getDefaultValue($entity); return an empty array

🐛 Bug report
Status

Fixed

Version

1.7

Component

Code

Created by

🇨🇦Canada vincent signoret

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