Problem/Motivation

In the logs, I find quite a bit of the following warnings:

Warning: Undefined variable $transition_machine_name in Drupal\\workflow_buttons\\Plugin\\Field\\FieldWidget\\WorkflowButtonsWidget::processActions() (line 271 of \/app\/web\/modules\/contrib\/workflow_buttons\/src\/Plugin\/Field\/FieldWidget\/WorkflowButtonsWidget.php)
"Warning: Undefined variable $transition_machine_name in Drupal\\workflow_buttons\\Plugin\\Field\\FieldWidget\\WorkflowButtonsWidget::processActions() (line 278 of \/app\/web\/modules\/contrib\/workflow_buttons\/src\/Plugin\/Field\/FieldWidget\/WorkflowButtonsWidget.php)

Steps to reproduce

Not sure.

Proposed resolution

Initialize the variable $transition_machine_name before using it.

Comments

ragnarkurm created an issue. See original summary.

ragnarkurm’s picture

ultrabob’s picture

Status: Active » Postponed (maintainer needs more info)

@ragnarkurm It would be really good to know what the value of

$transition_data

in cases where that code path is triggered, maybe there is a way to make sure we never get that far without the data we need.

I'd request three things from you if it is possible:

  1. The value of $transition_data when you reach that watchdog log
  2. What your workflow configuration looks like for the entity type in question
  3. If there are any particular actions you take that make the difference between having the error and not having it (i.e. it only happens when newly creating content, or it only happens on a specific transition)
mlncn’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

We are already logging an unexpected-ish state (falsy value for a given transition ID in $transition_data) and know there is at least some transition data. We can prevent this warning and if no one else has run into it figure it is rare enough that when anybody cares enough this existing log message will help the debugging.

  • mlncn committed 814fcb47 on 2.0.x
    feat: #3404921 Warning: Undefined variable $transition_machine_name
    
    By...
damienmckenna’s picture

Should this be "fixed" or "postponed (needs more info)"?

mlncn’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.