8000 bug #41582 Fix not null get collection key types (dragosprotung) · symfony/symfony@22fd960 · GitHub
[go: up one dir, main page]

Skip to content

Commit 22fd960

< 8000 span role="tooltip" aria-label="Browse the repository at this point in the history" id=":R1abab:" class="Tooltip__TooltipBase-sc-17tf59c-0 jjwhNb d-none d-md-flex tooltipped-sw">Browse files
bug #41582 Fix not null get collection key types (dragosprotung)
This PR was merged into the 5.3 branch. Discussion ---------- Fix not null get collection key types | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | - <!-- required for new features --> `Warning: Undefined array key 0` is generated because `getCollectionKeyTypes` never returns `null` so a check against empty array is needed. Commits ------- e7552ab [Serializer] Fix not null return check by "getCollectionKeyTypes"
2 parents e91c0b8 + e7552ab commit 22fd960

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
@@ -470,7 +470,7 @@ private function validateAndDenormalize(string $currentClass, string $attribute,
470470
$builtinType = Type::BUILTIN_TYPE_OBJECT;
471471
$class = $collectionValueType->getClassName().'[]';
472472

473-
if (null !== $collectionKeyType = $type->getCollectionKeyTypes()) {
473+
if (\count($collectionKeyType = $type->getCollectionKeyTypes()) > 0) {
474474
[$context['key_type']] = $collectionKeyType;
475475
}
476476
} elseif ($type->isCollection() && \count($collectionValueType = $type->getCollectionValueTypes()) > 0 && Type::BUILTIN_TYPE_ARRAY === $collectionValueType[0]->getBuiltinType()) {

0 commit comments

Comments
 (0)
0