You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I found out about a rather unexpected interaction. This code doesn't work, throwing an ConstraintDefinitionException (No default option is configured for constraint):
$options = ['message'=>'Hello'];
array_walk($options, function(&$item) { $item = $item . ' world!'; });
$constraint = newEmail($options); // Not working
In order to make it work, I have to use reset($options) after array_walk() so that I get a valid array pointer. I propose to either output a meaningful error message (that Constraint cannot be initialized without valid internal pointer) or to replace is_string(key($options)) in Symfony\Component\Validator\Constraint to something like is_string(array_keys($options)[0]).