Skip to content

Commit

Permalink
Merge pull request #104 from tyler-sommer/recursion-fix
Browse files Browse the repository at this point in the history
Potential fix for "recursion detected" issue
  • Loading branch information
schmittjoh committed Jan 9, 2014
2 parents cf70eea + 3a151d1 commit 6c3982f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/JMS/Serializer/JsonSerializationVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function endVisitingObject(ClassMetadata $metadata, $data, array $type, C
$rs = new \ArrayObject();

if (array() === $this->getRoot()) {
$this->setRoot($rs);
$this->setRoot(clone $rs);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public function testSerializeEmptyObject()
$this->assertEquals('{}', $this->serialize(new Author(null)));
}

public function testSerializeArrayWithEmptyObject()
{
$this->assertEquals('{"0":{}}', $this->serialize(array(new \stdClass())));
}

protected function getFormat()
{
return 'json';
Expand Down

0 comments on commit 6c3982f

Please sign in to comment.