You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the objects are correctly serialized or unserialized
Actual Result
the serialized object is empty
In DependencyInjection/JMSSerializerExtension.php, a new driver is added, the attribute_driver, which has priority over the annotation driver.
$metadataDrivers = [
new Reference('jms_serializer.metadata.yaml_driver'),
new Reference('jms_serializer.metadata.xml_driver'),
new Reference('jms_serializer.metadata.attribute_driver'),
new Reference('jms_serializer.metadata.annotation_driver'),
];
Now in vendor/jms/metadata/src/Driver/DriverChain.php, the annotation driver always produces a metadata object, even though no jms annotations are used. The result object has no metadata, but it's not null.
I don't have a clean way of testing this since the main app I work in has the jms_serializer.metadata_driver service overloaded to fully remove annotation support (we have them completely disabled), but looking over #920, the one thing I can think to suggest is to flip the order of the drivers here.
But, I get the feeling this is exposing a bigger problem with those drivers if the annotation or attribute drivers are returning unconfigured Metadata\ClassMetadata objects instead of null like the XML or YAML drivers do when there is no metadata, and it's only showing up because of the changes introduced with that PR.
Steps required to reproduce the problem
Expected Result
Actual Result
In
DependencyInjection/JMSSerializerExtension.php
, a new driver is added, the attribute_driver, which has priority over the annotation driver.Now in
vendor/jms/metadata/src/Driver/DriverChain.php,
the annotation driver always produces a metadata object, even though no jms annotations are used. The result object has no metadata, but it's not null.Therefore we never reach the AnnotationDriver and all jms annotations are subsequently ignored.
The text was updated successfully, but these errors were encountered: