From 287540433a1a6bdadb2bbe94a6047dcd1b434605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 4 Apr 2020 09:41:07 +0200 Subject: [PATCH] [Serializer] Fix configuration of the cache key --- .../Serializer/Normalizer/AbstractObjectNormalizer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index be4f9c47ae729..392e19e71e373 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -115,7 +115,7 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory throw new InvalidArgumentException(sprintf('The "%s" given in the default context is not callable.', self::MAX_DEPTH_HANDLER)); } - $this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] = [self::CIRCULAR_REFERENCE_LIMIT_COUNTERS]; + $this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] = array_merge($this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] ?? [], [self::CIRCULAR_REFERENCE_LIMIT_COUNTERS]); $this->propertyTypeExtractor = $propertyTypeExtractor; @@ -359,7 +359,7 @@ public function denormalize($data, $type, $format = null, array $context = []) try { $this->setAttributeValue($object, $attribute, $value, $format, $context); } catch (InvalidArgumentException $e) { - throw new NotNormalizableValueException(sprintf('Failed to denormalize attribute "%s" value for class "%s": %s.', $attribute, $type, $e->getMessage()), $e->getCode(), $e); + throw new NotNormalizableValueException(sprintf('Failed to denormalize attribute "%s" value for class "%s": "%s".', $attribute, $type, $e->getMessage()), $e->getCode(), $e); } }