-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
FlattenException $previous property not documented as nullable #40385
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
Comments
The properties on |
…ception (derrabus) This PR was merged into the 4.4 branch. Discussion ---------- [ErrorHandler] Added missing type annotations to FlattenException | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #40385 | License | MIT | Doc PR | N/A This class has no constructor where the properties' types could be inferred from. If we want potential contributors (and our serializer, see #40385) to read that code, I think it's only fair that we document the property types via doc blocks. Commits ------- d68832e [ErrorHandler] Added missing type annotations to FlattenException
@maciejzgadzaj I've just merged the changes up to 5.2 and 5.x. |
Great news, thank you very much @derrabus ! Now I just need to wait for v5.2.6... |
You can test the changes right away if you like. "require": {
"symfony/error-handler": "~5.2.6@dev"
} |
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 5.2.3
Description
The
$previous
property ofFlattenException
is not documented as nullable, and it denormalizes incorrectly when set tonull
.How to reproduce
Output:
Possible Solution
Super simple - just adding a PHPDoc for the property:
then executing the same code as above returns:
Additional context
This was found out when using consuming Pub/Sub messages with
symfony/messenger
andsroze/messenger-enqueue-transport
, which useFlattenException
forErrorDetailsStamp
.When the message handler fails processing the message for the very first time, it adds
ErrorDetailsStamp
with exception flattened (and"previous": null
).On first retry, the stamp is deserialized, and what originally was
turns into
(This is our issue right here.)
Finally, when processing fails again, the
ErrorDetailsStamp
(with all the abovenull
s) fails deserialization with the following errors:Which means retrying to handle the message works fine as long as
max_retries
is set to1
, but fails if it's anything above this.Adding mentioned PHPDoc makes it work perfectly fine.
The text was updated successfully, but these errors were encountered: