Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 5.4:
  [Mime] Fix serializing uninitialized RawMessage::$message to null
  [Notifer][Smsapi] Set messageId of SentMessage
  [DX] Use Symfony "dark-mode"-responsive logo in README
  support lazy evaluated exception messages with Xdebug 3
  • Loading branch information
nicolas-grekas committed Jan 30, 2024
2 parents 95767d5 + 02acd86 commit 917d5ec
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Normalizer/MimeMessageNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Mime\Header\UnstructuredHeader;
use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\Part\AbstractPart;
use Symfony\Component\Mime\RawMessage;
use Symfony\Component\Serializer\Exception\LogicException;
use Symfony\Component\Serializer\SerializerAwareInterface;
use Symfony\Component\Serializer\SerializerInterface;
Expand Down Expand Up @@ -74,15 +75,18 @@ public function normalize(mixed $object, ?string $format = null, array $context
return $ret;
}

$ret = $this->normalizer->normalize($object, $format, $context);

if ($object instanceof AbstractPart) {
$ret = $this->normalizer->normalize($object, $format, $context);
$ret['class'] = $object::class;
unset($ret['seekable'], $ret['cid'], $ret['handle']);
}

return $ret;
if ($object instanceof RawMessage && \array_key_exists('message', $ret) && null === $ret['message']) {
unset($ret['message']);
}

return $this->normalizer->normalize($object, $format, $context);
return $ret;
}

public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
Expand Down

0 comments on commit 917d5ec

Please sign in to comment.