diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index 8c8ce2fcea71..1447091a4c60 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -57,6 +57,7 @@ protected function extractAttributes($object, $format = null, array $context = a } $name = $reflMethod->name; + $attributeName = null; if (0 === strpos($name, 'get') || 0 === strpos($name, 'has')) { // getters and hassers @@ -66,7 +67,7 @@ protected function extractAttributes($object, $format = null, array $context = a $attributeName = lcfirst(substr($name, 2)); } - if ($this->isAllowedAttribute($object, $attributeName)) { + if (null !== $attributeName && $this->isAllowedAttribute($object, $attributeName)) { $attributes[$attributeName] = true; } }