diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 348ab78bb267..b3111eaa1820 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -68,7 +68,7 @@ public function normalize($object, $format = null, array $context = array()) } $attributeValue = $method->invoke($object); - if (array_key_exists($attributeName, $this->callbacks)) { + if (isset($this->callbacks[$attributeName])) { $attributeValue = call_user_func($this->callbacks[$attributeName], $attributeValue); } if (null !== $attributeValue && !is_scalar($attributeValue)) { diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php index b54187abb298..5acadde2e7e3 100644 --- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php @@ -64,7 +64,7 @@ public function normalize($object, $format = null, array $context = array()) $attributeValue = $property->getValue($object); - if (array_key_exists($property->name, $this->callbacks)) { + if (isset($this->callbacks[$property->name])) { $attributeValue = call_user_func($this->callbacks[$property->name], $attributeValue); } if (null !== $attributeValue && !is_scalar($attributeValue)) {