Error: Call to a member function findTransition() on false in class StateItem

Created on 8 January 2025, 14 days ago

Problem/Motivation

The method \Drupal\state_machine\Plugin\Field\FieldType\StateItem::dispatchTransitionEvent uses $workflow = $this->getWorkflow() and right after uses $workflow->findTransition().
The problem is that the method getWorkflow() can return false. In that case, we'll get a the error mentioned in the title.

Steps to reproduce

I can reproduce it in a very specific way that is not really interesting.
Just by looking to the code we ca see the problem.

Proposed resolution

Check if $workflow an instance of WorkflowInterface before using it in $workflow->findTransition().

๐Ÿ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡ต๐Ÿ‡นPortugal dxvargas

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