Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ConstraintVisitor crash $messages is undefined #48767

Closed
@maisoui

Description

@maisoui

Symfony version(s) affected

6.2.2

Description

When using command "php bin/console translation:extract --force fr" to extract translations, I receive the following error exception:
Warning: Undefined variable $messages

If you use constraints without translatable field, the messages array isn't defined.

How to reproduce

Create an entity with the following constraint:
@RollerworksPassword\PasswordStrength(minLength=6, minStrength=3)

Use command "php bin/console translation:extract --force fr"

Possible Solution

Modify the code of ConstraintVisitor.php (line 97) to check if messages array is defined:

if(isset($messages)) { foreach($messages as $message) { $this->addMessageToCatalogue($message, 'validators', $node->getStartLine()); } }

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