8000 [Serializer] Fix MetadataAwareNameConverter usage with string group · symfony/symfony@d4f749a · GitHub
[go: up one dir, main page]

Skip to content

Commit d4f749a

Browse files
committed
[Serializer] Fix MetadataAwareNameConverter usage with string group
fixes 34455
1 parent 996d8a7 commit d4f749a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private function getCacheValueForAttributesMetadata(string $class, array $contex
123123
if (!$groups && ($context[AbstractNormalizer::GROUPS] ?? [])) {
124124
continue;
125125
}
126-
if ($groups && !array_intersect($groups, $context[AbstractNormalizer::GROUPS] ?? [])) {
126+
if ($groups && !array_intersect($groups, (array) ($context[AbstractNormalizer::GROUPS] ?? []))) {
127127
continue;
128128
}
129129

src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public function attributeAndContextProvider()
146146
return [
147147
['buz', 'buz', ['groups' => ['a']]],
148148
['buzForExport', 'buz', ['groups' => ['b']]],
149+
['buz', 'buz', ['groups' => 'a']],
150+
['buzForExport', 'buz', ['groups' => 'b']],
149151
['buz', 'buz', ['groups' => ['c']]],
150152
['buz', 'buz', []],
151153
];

0 commit comments

Comments
 (0)
0