From 24f77a01be5a73d420f2220b4cc8bc9fdd8c4ad7 Mon Sep 17 00:00:00 2001 From: Emmanuel BORGES Date: Wed, 6 Mar 2019 12:40:11 +0100 Subject: [PATCH] Fix getSetMethodNormalizer to correctly ignore the attributes specified in "ignored_attributes" --- UPGRADE-4.2.md | 1 + .../Component/Serializer/Normalizer/GetSetMethodNormalizer.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/UPGRADE-4.2.md b/UPGRADE-4.2.md index 90cd04d01e69..9c9b4c52e7bf 100644 --- a/UPGRADE-4.2.md +++ b/UPGRADE-4.2.md @@ -179,6 +179,7 @@ FrameworkBundle * The `Templating\Helper\TranslatorHelper::transChoice()` method has been deprecated, use the `trans()` one instead with a `%count%` parameter. * Deprecated support for legacy translations directories `src/Resources/translations/` and `src/Resources//translations/`, use `translations/` instead. * Support for the legacy directory structure in `translation:update` and `debug:translation` commands has been deprecated. + * The `GetSetMethodNormalizer` class correctly ignores the attributes specified in "ignored_attributes". HttpFoundation -------------- diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 07c5671752a9..23b589c2afff 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -110,7 +110,7 @@ protected function extractAttributes($object, $format = null, array $context = [ $attributeName = lcfirst(substr($method->name, 0 === strpos($method->name, 'is') ? 2 : 3)); - if ($this->isAllowedAttribute($object, $attributeName)) { + if ($this->isAllowedAttribute($object, $attributeName, null, $context)) { $attributes[] = $attributeName; } }