From 0d28a1d992aadaf74504ef6183b9349c3dfdb42a 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 | 3 ++- .../Component/Serializer/Normalizer/GetSetMethodNormalizer.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/UPGRADE-4.2.md b/UPGRADE-4.2.md index 90cd04d01e69a..26a0632daf8bf 100644 --- a/UPGRADE-4.2.md +++ b/UPGRADE-4.2.md @@ -179,11 +179,12 @@ 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 `AbstractNormalizer::IGNORED_ATTRIBUTES`. HttpFoundation -------------- - * The default value of the `$secure` and `$samesite` arguments of Cookie's constructor + * The default value of the `$secure` and `$samesite` arguments o`f Cookie's constructor will respectively change from `false` to `null` and from `null` to `lax` in Symfony 5.0, you should define their values explicitly or use `Cookie::create()` instead. diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 07c5671752a9d..23b589c2afffd 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; } }