Skip to content

[Validator] ChoiceValidator Causes Fatal Error with 2.4 API Version in Symfony 2.5.3 #11714

Closed
@chrisguitarguy

Description

@chrisguitarguy

Using Validation::API_VERSION_2_4 with a Choice constraint causes a fatal error:

Fatal error: Call to undefined method Symfony\Component\Validator\ExecutionContext::buildViolation() in vendor/symfony/validator/Symfony/Component/Validator/Constraints/ChoiceValidator.php on line 92

Quick test case to reproduce the issue:

<?php

require __DIR__.'/vendor/autoload.php';

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Validation;

$validator = Validation::createValidatorBuilder()
    ->setApiVersion(Validation::API_VERSION_2_4)
    ->getValidator();

$validator->validateValue(['one'], new Assert\Choice(['two']));

Works just fine with the 2.5 API version and was working with Symfony 2.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions