Closed
Description
Symfony version(s) affected: 5.2.5
Description
On a normally working Symfony project, we send an email on user login
After upgrading to Symfony 5.2.5 this now creates an error
How to reproduce
I think the cause is passing in Entities and Objects to the context, which might have closures in them.
Im passing into the context the User object and the LoginSuccessEvent event in my live app.
You can replicate this by changing the UnitTest to have a closure in the context of the templated email as follows, this will result in the broken unit test with the same error Im experiencing.
// changing the testRenderedOnce test you can replicate this
$closure = function ($name){
return $name;
};
$email = (new TemplatedEmail())
->to('fabien@symfony.com')
->from('helene@symfony.com')
->context(['event'=>$closure])
;
Possible Solution
re-review of #39733 which was added in 5.2.5 and the error message relates to.
Additional context
Transport is a standard SMTP.