Closed
Description
Symfony version(s) affected
7.0.7
Description
i inherited the following code, and now i am unsure wether this is a bug in the last patch-release or a bug in my code. up until version 7.0.6 it worked just fine so far.
How to reproduce
<?xml version="1.0" encoding="UTF-8"?>
<Trias>
<ServiceDelivery>
<DeliveryPayload>
<TripResponse>
<foo />
<foo />
</TripResponse>
</DeliveryPayload>
</ServiceDelivery>
</Trias>
with the following DTOs
final class Trias
{
private ?ServiceDeliveryStructure $serviceDelivery = null;
/**
* @return ServiceDeliveryStructure
*/
public function getServiceDelivery()
{
return $this->serviceDelivery;
}
public function setServiceDelivery(ServiceDeliveryStructure $serviceDelivery): void
{
$this->serviceDelivery = $serviceDelivery;
}
}
final class ServiceDeliveryStructure
{
private ?DeliveryPayloadStructure $deliveryPayload = null;
/**
* @return DeliveryPayloadStructure
*/
public function getDeliveryPayload()
{
return $this->deliveryPayload;
}
public function setDeliveryPayload(DeliveryPayloadStructure $deliveryPayload): void
{
$this->deliveryPayload = $deliveryPayload;
}
}
final class DeliveryPayloadStructure
{
private ?TripResponse $tripResponse = null;
/**
* @return TripResponse
*/
public function getTripResponse()
{
return $this->tripResponse;
}
public function setTripResponse(TripResponse $tripResponse): void
{
$this->tripResponse = $tripResponse;
}
}
starting with version 7.0.7 i'll get the following error:
Symfony\Component\Serializer\Exception\NotNormalizableValueException: The type of the "tripResponse" attribute for class "EosUptrade\FIS\TRIAS\Dto\DeliveryPayloadStructure" must be one of "EosUptrade\FIS\TRIAS\Dto\TripResponse" ("array" given).
when calling
$serializer->deserialize($content, Trias::class, XmlEncoder::FORMAT);
with the following service configuration:
$services->set('trias.name_converter', UppercaseFirstLetterNameConverter::class);
$services->set('trias.property_type_extractor', PhpDocExtractor::class);
$services
->set('trias.get_set_method_normalizer', GetSetMethodNormalizer::class)
->args([
null,
service('trias.name_converter'),
service('trias.property_type_extractor'),
]);
$services->set('trias.array_denormalizer', ArrayDenormalizer::class);
$services->set('trias.xml_encoder', XmlEncoder::class);
$services
->set('trias.serializer', Serializer::class)
->public()
->args([
[
service('trias.get_set_method_normalizer'),
service('trias.array_denormalizer'),
],
[service('trias.xml_encoder')],
]);
Possible Solution
No response
Additional Context
No response