PHP fatal error when trying to edit a condition that references a deleted term

Created on 6 December 2022, about 2 years ago
Updated 2 April 2023, almost 2 years ago

Problem/Motivation

Fix PHP fatal error when trying to edit a condition that references a deleted term

Steps to reproduce

1. Create a condition (e.g. in a block visibility group) that references a given term.
2. Delete the term from Taxonomies > List Terms page.
3. Try to edit the condition created at 1. You will receive error:
Call to a member function getName() on null in Drupal\term_condition\Plugin\Condition\Term->summary() (line 201 of modules/contrib/term_condition/src/Plugin/Condition/Term.php).

Proposed resolution

Check if term exists before calling getName()

Remaining tasks

1. Test patch.
2. Merge patch.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇷🇴Romania abautu

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024