Skip to content

Commit 5933418

Browse files
committed
~ fix for new TypeIdentifier
1 parent 8449d56 commit 5933418

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,18 @@ private function validateAndDenormalize(Type $type, string $currentClass, string
760760
}
761761
}
762762

763+
if (is_numeric($data) && XmlEncoder::FORMAT === $format) {
764+
// encoder parsed them wrong, so they might need to be transformed back
765+
switch ($typeIdentifier) {
766+
case TypeIdentifier::STRING:
767+
return (string) $data;
768+
case TypeIdentifier::FLOAT:
769+
return (float) $data;
770+
case TypeIdentifier::INT:
771+
return (int) $data;
772+
}
773+
}
774+
763775
if ($collectionValueType) {
764776
try {
765777
$collectionValueBaseType = $collectionValueType;

0 commit comments

Comments
 (0)