Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

5.2.5 regression on sending email Serialization of 'Closure' is not allowed #40445

Copy link
Copy link
Closed
@PhilETaylor

Description

@PhilETaylor
Issue body actions

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

Screenshot 2021-03-11 at 12 46 44

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])
        ;

Screenshot 2021-03-11 at 13 12 15

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.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.