[Debug][BC Break] Fixed deserialization of FlattenException by the Serializer component #33630
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As spotted in #32719, the Serializer component is unable to deserialize some
FlattenException
instances, which breaks the messenger component when used with the symfony serializer.While this can't be fixed in
FlattenException
without breaking BC, as the main/sole purpose of this class is to be serialization friendly, I thought it was a real issue.Also, it should only break classes that extend
FlattenException
and I couldn't find a single project on Github that does this, nor imagine why anyone would want to (actually, I believe this class should have been marked final).Here are all the issues I identified, and how they are fixed by this PR:
getHeaders
can returnnull
orarray
, butsetHeaders
had anarray
type-hint: I removed the type hintgetPrevious
can returnnull
orself
, butsetPrevious
had aself
type-hint: I removed the type-hintsetTrace
required 3 arguments, and added a new frame to the trace: the file and line arguments are now optional, and I try to detect whether the passed trace has already been processed or not. This may not be the best thing to do IMHO, but an attempt to limit the BC break to subclasses and ensure usage of the class doesn't get broken.Note: The same issues affect the
FlattenException
class of the new ErrorRenderer component, but I will submit an new issue to discuss the best solution here, as I would also like to discuss #32873 and propose an alternate solution to #32473.