From d3368db9986caa3fd12b7efec6aa39cf340b0f8b Mon Sep 17 00:00:00 2001 From: Xavier Leune Date: Thu, 20 Mar 2025 09:28:38 +0100 Subject: [PATCH] Fix: allow null when using symfony/serializer --- CHANGELOG | 1 + src/TingBundle/Serializer/SymfonySerializer.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d43b178..db3943f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ 3.10.1 (unreleased): * Fix: autoincrement fields are now properly registered when using attributes + * Fix: allow null when using symfony/serializer 3.10.0 (2025-03-14): * Feature: Allow complex types to be handled by symfony/serializer if available diff --git a/src/TingBundle/Serializer/SymfonySerializer.php b/src/TingBundle/Serializer/SymfonySerializer.php index 226d9cb..cc3fdb8 100644 --- a/src/TingBundle/Serializer/SymfonySerializer.php +++ b/src/TingBundle/Serializer/SymfonySerializer.php @@ -16,6 +16,9 @@ public function serialize($toSerialize, array $options = []) public function unserialize($serialized, array $options = []) { + if ($serialized === null) { + return null; + } $this->throwOnNullSerializer(); if (!isset($options['type'])) { throw new \RuntimeException('SymfonySerializer requires type option to be set');