Skip to content

UniqueEntityValidator with multiple constraints fails if the first constraint is null #21554

@ghost

Description

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.8.17

Scenario: I'm validating an entity like this

$validator->validate($device, [
    new UniqueEntity([
        'fields' => ['accountId', 'tenantUuid'],
        'em' => $provisioningEm
    ])
]);

If accountId happens to be null, UniqueEntityValidator will now exclude it from the constraint list (since commit 1e3421d ), failing later on because $criteria[$fields[0]] is an invalid array access: fields[0] is the string "accountId", which is not in $criteria.
Reverting lines 88-94 to the version before the commit linked above fixes the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy