Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5933418

Browse filesBrowse files
committed
~ fix for new TypeIdentifier
1 parent 8449d56 commit 5933418
Copy full SHA for 5933418

File tree

1 file changed

+12
-0
lines changed
Filter options

1 file changed

+12
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+12
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.