Closed
Description
Symfony version(s) affected
5.3
Description
The denormalization of array with null
value in previous
index to Symfony\Component\ErrorHandler\Exception\FlattenException
is failing.
The denormalize method check if previous
index is set and not if it is not null. Moreover, the setPrevious
method of FlattenException
strictly expect a FlattenException
instance.
[Symfony\Component\Messenger\Exception\MessageDecodingFailedException]
Could not decode stamp: Failed to denormalize attribute "previous" value fo
r class "Symfony\Component\ErrorHandler\Exception\FlattenException": Expect
ed argument of type "Symfony\Component\ErrorHandler\Exception\FlattenExcept
ion", "null" given at property path "previous".
How to reproduce
Hard to say for all cases, but in my case it happens when messenger:consume
command fails due to a Symfony\Component\Messenger\Exception\HandlerFailedException
.
Possible Solution
Fix the type of the argument of the setter:
<?php
class FlattenException
{
/**
* @return $this
*/
public function setPrevious(?self $previous): self
{
$this->previous = $previous;
return $this;
}
Additional Context
No response