Closed
Description
Symfony version(s) affected
6.2-dev
Description
I am sending a message with Mailer. And when the profile data is being collected I get an error. Stack strace to relevant parents.
I get an error, full stack trace:
Scenario: I can change my password # features/user/change_password_form.feature:12
And I should get a "change_password_notification" email sent # features/user/change_password_form.feature:27
BadMethodCallException: Cannot unserialize Symfony\Component\Mime\Part\DataPart in vendor/symfony/mime/Part/DataPart.php:162
Stack trace:
#0 [internal function]: Symfony\Component\Mime\Part\DataPart->__wakeup()
How to reproduce
Send an email message with a file attached and profiler enabled.
Possible Solution
The DataPart parent is...
array:6 [
"body" => Symfony\Component\Mime\Part\BodyFile {#11584
-path: "xxx/_CWA/api-components-bundle/src/Resources/views/assets/images/email_logo.png"
}
"charset" => null
"subtype" => "png"
"disposition" => "inline"
"name" => "@SilverbackApiComponents/assets/images/email_logo.png"
"encoding" => "base64"
]
As body is not a string, it causes this error.
For this perhaps... Symfony\Component\Mime\Part\BodyFile::__toString could be implemented
https://github.com/symfony/mime/blob/6.2/Part/BodyFile.php
and try to cast as a string in Symfony\Component\Mime\Part\DataPart::__wakeup
https://github.com/symfony/mime/blob/6.2/Part/DataPart.php#L161
Additional Context
No response