8000 Error Serialization of 'Generator' is not allowed · Issue #38430 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Error Serialization of 'Generator' is not allowed #38430
Closed
@gilbertsoft

Description

@gilbertsoft

We currently have an issue in the TYPO3 Core with our own implementation of the FileSpool inspired by Swift Mailer.

After a short investigation yesterday I have discovered the issue is coming from the serialization of the Symfony\Component\MailerSentMessage where the error Serialization of 'Generator' is not allowed is thrown. The problem here is the $raw property which is a generator see

$this->raw = new RawMessage($message->toIterable());

Afterwards if the method __serialize() of Symfony\Component\Mime\RawMessage gets called the generator is returned in the array instead of an array see

public function __serialize(): array
{
return [$this->message];
}

I changed that part during the debugging and for our use case that seems to work fine:

    public function __serialize(): array
    {
        return [$this->toString()];
    }

I'm not fully aware of the impact here but I guess this could be a solution in general.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0