-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mime] MessagePart does not support serialization - Profiler fails if Message with MessagePart is collected #48313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Amunak
added a commit
to Amunak/symfony
that referenced
this issue
Nov 24, 2022
nicolas-grekas
pushed a commit
to Amunak/symfony
that referenced
this issue
Dec 13, 2022
nicolas-grekas
added a commit
that referenced
this issue
Dec 13, 2022
This PR was merged into the 5.4 branch. Discussion ---------- [Mime] Fix MessagePart serialization | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #48313 | License | MIT | Doc PR | n/a Fixes serialization of Symfony\Component\Mime\Part\MessagePart and adds test coverage. Commits ------- 8cb094c bug #48313 [Mime] Fix MessagePart serialization
nicolas-grekas
added a commit
that referenced
this issue
Dec 14, 2022
* 5.4: [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Use relative timestamps [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug #48313 [Mime] Fix MessagePart serialization [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" fix dumping top-level tagged values
nicolas-grekas
added a commit
that referenced
this issue
Dec 14, 2022
* 6.0: [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Use relative timestamps [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug #48313 [Mime] Fix MessagePart serialization [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" fix dumping top-level tagged values
nicolas-grekas
added a commit
that referenced
this issue
Dec 14, 2022
* 6.1: [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Fix HtmlSanitizer default configuration behavior for allowed schemes Use relative timestamps [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug #48313 [Mime] Fix MessagePart serialization [HttpKernel][ErrorHandler] Fix reading the SYMFONY_IDE env var [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" fix dumping top-level tagged values [Console] Fix clear line with question in section
nicolas-grekas
added a commit
that referenced
this issue
Dec 14, 2022
* 6.2: (22 commits) [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Hide excluded services from container debug list [Validator] Allow opt-out of EmailValidator deprecation when using Validation::createValidatorBuilder() Fix HtmlSanitizer default configuration behavior for allowed schemes Use relative timestamps [Translation] add tests + fix [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug #48313 [Mime] Fix MessagePart serialization [HttpKernel][ErrorHandler] Fix reading the SYMFONY_IDE env var [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" ...
PhilETaylor
pushed a commit
to PhilETaylor/symfony
that referenced
this issue
Sep 6, 2023
* 5.4: [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Use relative timestamps [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug symfony#48313 [Mime] Fix MessagePart serialization [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" fix dumping top-level tagged values
PhilETaylor
pushed a commit
to PhilETaylor/symfony
that referenced
this issue
Sep 6, 2023
* 6.0: [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Use relative timestamps [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug symfony#48313 [Mime] Fix MessagePart serialization [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" fix dumping top-level tagged values
PhilETaylor
pushed a commit
to PhilETaylor/symfony
that referenced
this issue
Sep 6, 2023
* 6.1: [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Fix HtmlSanitizer default configuration behavior for allowed schemes Use relative timestamps [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug symfony#48313 [Mime] Fix MessagePart serialization [HttpKernel][ErrorHandler] Fix reading the SYMFONY_IDE env var [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" fix dumping top-level tagged values [Console] Fix clear line with question in section
PhilETaylor
pushed a commit
to PhilETaylor/symfony
that referenced
this issue
Sep 6, 2023
* 6.2: (22 commits) [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Hide excluded services from container debug list [Validator] Allow opt-out of EmailValidator deprecation when using Validation::createValidatorBuilder() Fix HtmlSanitizer default configuration behavior for allowed schemes Use relative timestamps [Translation] add tests + fix [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug symfony#48313 [Mime] Fix MessagePart serialization [HttpKernel][ErrorHandler] Fix reading the SYMFONY_IDE env var [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
4.3.0-6.2 (all)
Description
Object
Symfony\Component\Mime\Part\MessagePart
does not support serialization.This will most likely manifest in Profiler failing to save the collected MessagePart, but it could break other (user) code as well.
There are really two problems:
__sleep
magic method. Parent__sleep
gets called, but that returns wrong/different property names than exist in the object (because parent's are private), so the most important property for this object ($message
) is not serialized, and when unserialized methods likegetBody
fail unexpectadly because property$message
is null.Warning: serialize(): "filename" returned as member variable from __sleep() but does not exist
, as from the point of view of this child object that property truly does not exist. However that property is required for the object to work properly, and it should either be saved or parent constructor needs to be called correctly on unserialization (__wakeup
call).How to reproduce
Add the following test to MessagePartTest:
You will observe it will fail.
Possible Solution (see #48314)
Implement magic
__sleep
and__wakeup
methods, for example like so:Additionally I think it would be a great idea to improve FileProfilerStorage so that it fails gracefully if (one of) the Collectors has an issue and fails the serialization. In testing I used something like this for the
write
function (and inverse fordoRead
):which still allows all but the one failing Collector to save so that you have at least something to debug with.
The text was updated successfully, but these errors were encountered: