Invalid argument error when editing a workflow which was created with no states and/or transitions

Created on 4 August 2017, about 7 years ago
Updated 27 June 2023, about 1 year ago

Problem/Motivation

When editing a Workflow which has been created with either no states or no transitions (or both)) an Invalid argument error will be displayed.

No states: Warning: Invalid argument supplied for foreach() in Drupal\workflows\Form\WorkflowEditForm->copyFormValuesToEntity() (line 276 of core/modules/workflows/src/Form/WorkflowEditForm.php).

No transitions: Warning: Invalid argument supplied for foreach() in Drupal\workflows\Form\WorkflowEditForm->copyFormValuesToEntity() (line 279 of core/modules/workflows/src/Form/WorkflowEditForm.php).

This will only occur in rare cases where the Workflow Plugin does no provide any required states and when creating the Workflow the user chooses not to create the initial state when prompted. In this scenario it appears that in some cases $form_state->getValues() may not contain the states or transitions keys, which results in the errors being shown.

Tested using the Workflows Field β†’ contrib module, which provides a plugin with no required states.

Currently this does not appear to be reliably reproducible, no other information is currently available which would indicate why this is not reliably reproducible.

Proposed resolution

Remaining tasks

Determine if code should be refactored to prevent the errors from being triggered, or wait until this can be more reliably reproduced.

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
WorkflowsΒ  β†’

Last updated 5 months ago

  • Maintained by
  • πŸ‡¦πŸ‡ΊAustralia @Sam152
Created by

πŸ‡¦πŸ‡ΊAustralia Sam152

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

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