Skip to content

[BC Break][Bug] Form is validating constraints of wrong validation group in 3.1.4 / 3.2 #20853

Closed
@peterrehm

Description

@peterrehm

#19388 introduces a BC break which just hit me.

I am having an application where FOSUserBundle is used and I have a form manipulating some fields of the custom user entity. Since the above mentioned PR the validator insists on constraints which are not in the same validation group.

E.g. the plainPassword constraint (https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/config/validation.xml#L56) is a problem.

When looking at #19388 it seems after some debugging, that just all constraints of an entity are registered in the defaultValidationGroup which ist just wrong.

     $member->constraintsByGroup[$this->getDefaultGroup()][] = $constraint;

The constraint has the following config extracted from a dump:

NotBlank {#1492 
  +message: "fos_user.password.blank"
  +payload: null
  +"groups": array:3 [
    0 => "Registration"
    1 => "ResetPassword"
    2 => "ChangePassword"
  ]
}

As I see it it must not be registered into the default group which is User in this case.

@senaria can you have a look into that again? I havent had much time to wok around this,
but based on your PR comments I think the adjustment should be mage related to GroupSequence
only?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions