Skip to content

[Validator] CharsetValidator throws TypeError when the value has an invalid charset #56805

Closed
@ludekbenedik

Description

@ludekbenedik

Symfony version(s) affected

7.1.0-RC1

Description

In CharsetValidator.php line 41:

[TypeError]
implode(): Argument 2 ($array) must be of type ?array, string given

How to reproduce

$this->validator->validate(substr('á', 0, 1), new Assert\Charset('UTF-8'));

Possible Solution

CharsetValidator.php line 41: ->setParameter('{{ encodings }}', implode(', ', (array) $constraint->encodings))

Additional Context

No response

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