Skip to content

[Workflow] apply call useless code #31582

@noniagriconomie

Description

@noniagriconomie

Symfony version(s) affected: 3.4 LTS

Description

Workflow::apply dispatch useless events, meaning useless code execution

Note: code patched in 4.2, after a discussion with @lyrixx he recommended to me to open an issue, and then a PR

How to reproduce

Given this workflow

workflow

When the subject is in "assigned" and I call workflow->apply(subject, "confirm")

the code executes all guards due to this line to retreive transitions https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Workflow/Workflow.php#L128
even if i know whoch transition i want to apply as it is the 2nd params

In 4.2, code is ok
https://github.com/symfony/symfony/blob/4.2/src/Symfony/Component/Workflow/Workflow.php#L152

Possible Solution

Retro patch this code part from 4.2 to 3.4

Additional context

3.4 is an LTS, and i really think this is a bug as it call/exec useless code

Thank you,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions