Error: Typed property Drupal\entity_legal\EntityLegalPluginBase::$documents must not be accessed before initialization

Created on 8 January 2025, 3 months ago

Problem/Motivation

A custom module extending EntityLegalPluginBase caused this error on upgrade from Drupal core 10.2 to 10.3. It implemented execute that looped through the documents parameter.

Steps to reproduce

Create a plugin that extends EntityLegalPluginBase on a D10.3 site. Have an execute method that loops through documents without initialising it.

Proposed resolution

Rather than check for documents being undefined, initialise it to an empty array in the base class.

Remaining tasks

Check patch that I attach.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇬🇧United Kingdom Rory Downes

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

Comments & Activities

Production build 0.71.5 2024