Skip to content

Commit

Permalink
do not skip the key if is not a scalar (it can be an object having a …
Browse files Browse the repository at this point in the history
…"__toString" method)
  • Loading branch information
goetas committed Oct 28, 2016
1 parent 10ac962 commit 62109f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/JMS/Serializer/GenericSerializationVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function visitArray($data, array $type, Context $context)
foreach ($data as $k => $v) {
$v = $this->navigator->accept($v, $this->getElementType($type), $context);

if (null === $v && ( ! is_scalar($k) || $context->shouldSerializeNull() !== true)) {
if (null === $v && $context->shouldSerializeNull() !== true) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/JMS/Serializer/YamlSerializationVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function visitArray($data, array $type, Context $context)
|| array_keys($data) === range(0, count($data) - 1);

foreach ($data as $k => $v) {
if (null === $v && ( ! is_scalar($k) || $context->shouldSerializeNull() !== true)) {
if (null === $v && $context->shouldSerializeNull() !== true) {
continue;
}

Expand Down

0 comments on commit 62109f5

Please # to comment.