bug #18838 [Serializer] ObjectNormalizer: add missing parameters (dunglas)

This PR was submitted for the master branch but it was merged into the 3.1 branch instead (closes #18838).

Discussion
----------

[Serializer] ObjectNormalizer: add missing parameters

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Please merge before the release of 3.1 (potential bug fix)

Commits
-------

58ac241 [Serializer] ObjectNormalizer: add missing parameters
This commit is contained in:
Fabien Potencier 2016-05-24 12:10:23 +02:00
commit 070a02ca7d

View File

@ -68,14 +68,14 @@ class ObjectNormalizer extends AbstractObjectNormalizer
$attributeName = lcfirst(substr($name, 2));
}
if (null !== $attributeName && $this->isAllowedAttribute($object, $attributeName)) {
if (null !== $attributeName && $this->isAllowedAttribute($object, $attributeName, $format, $context)) {
$attributes[$attributeName] = true;
}
}
// properties
foreach ($reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflProperty) {
if ($reflProperty->isStatic() || !$this->isAllowedAttribute($object, $reflProperty->name)) {
if ($reflProperty->isStatic() || !$this->isAllowedAttribute($object, $reflProperty->name, $format, $context)) {
continue;
}