10000 Fix order array sum normalizedData and nestedData · symfony/symfony@158ca81 · GitHub
[go: up one dir, main page]

Skip to content

Commit 158ca81

Browse files
committed
Fix order array sum normalizedData and nestedData
Previously, when `array_merge` was changed array+array in 6.3.5, the combined array result is changed as well. array_merge behaves differently than array+array. e.g.: ``` $a = ['key' => 'value-a']; $b = ['key' => 'value-b']; var_dump(array_merge($a, $b)); // Results in: // array(1) { // ["key"]=> // string(7) "value-b" // } var_dump($a + $b); // Results in: // array(1) { // ["key"]=> // string(7) "value-a" // } ``` By switching left with right, the result will be the same again.
1 parent 7aa60d6 commit 158ca81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
339339
$normalizedData = $this->removeNestedValue($serializedPath->getElements(), $normalizedData);
340340
}
341341

342-
$normalizedData = $normalizedData + $nestedData;
342+
$normalizedData = $nestedData + $normalizedData;
343343

344344
$object = $this->instantiateObject($normalizedData, $mappedClass, $context, new \ReflectionClass($mappedClass), $allowedAttributes, $format);
345345
$resolvedClass = ($this->objectClassResolver)($object);

0 commit comments

Comments
 (0)
0