Description
Symfony version(s) affected: 4.3.0
Description
Normalizers and encoders implementing \Symfony\Component\Serializer\SerializerAwareInterface
may become inconsistent when multiple serializers are defined.
How to reproduce
- Create custom definition of serializer service (autoconfigured, autowired).
- Create custom defintion of
PropertyNormalizer
service (autoconfigured, autowired) and pass it to the serializer from step 1. - Create custom denormalizer and pass it to the custom serializer from step 1 (DON'T autoconfigure or autowire it).
Into the existing serializer service definition (@serializer
) is the PropertyNormalizer
service mentioned above automatically passed because it is autocofigured. A that's the problem (I guess) because the instance of PropertyNormalizer
firstly receives through the \Symfony\Component\Serializer\SerializerAwareTrait::setSerializer
new definition of serializer and when the generic @serializer
is instatiated the custom serializer inside PropertyNormalizer
is overwritten by it but without the custom NON-tagged denormalizer. And that's causing problems when (de)normalizing data...