Closed
Description
Symfony version(s) affected: 4.3.3
Description
I'm trying to pass a variable named 'email' to Twig via ->context(). Causing preg_match() in Generator/UrlGenerator.php:179 to fail with "Warning: preg_match() expects parameter 2 to be string, object given"
Debugging the email var shows, that it somehow became a WrappedTemplatedEmail object.
How to reproduce
$message = (new TemplatedEmail())
->subject('...')
->from('...')
->to($user->getEmail())
->textTemplate('...')
->context([
'email' => $user->getEmail(),
'identifier' => urlencode($identifier),
])
$mailer->send($message);
Possible Solution
Renaming the variable 'email' to 'mail' fixes the issue.
Metadata
Metadata
Assignees
Labels
No labels