Skip to content

Commit

Permalink
Enable max depth for Symfony serializer too (#1935)
Browse files Browse the repository at this point in the history
  • Loading branch information
trandbert37 authored May 13, 2024
1 parent 760ebe9 commit f7e60c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Serializer/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use JMS\Serializer\SerializationContext;
use JMS\Serializer\SerializerInterface as JMSSerializer;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
use Symfony\Component\Serializer\SerializerInterface;

class Callback
Expand Down Expand Up @@ -83,7 +84,7 @@ public function setSerializeNull(bool $serializeNull): self

public function serialize($object): string
{
$context = $this->serializer instanceof JMSSerializer ? SerializationContext::create()->enableMaxDepthChecks() : [];
$context = $this->serializer instanceof JMSSerializer ? SerializationContext::create()->enableMaxDepthChecks() : [AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true];

if (!empty($this->groups)) {
if ($context instanceof SerializationContext) {
Expand Down

0 comments on commit f7e60c3

Please sign in to comment.