bug #31071 property normalizer should also pass format and context to isAllowedAttribute (dbu)

This PR was merged into the 3.4 branch.

Discussion
----------

property normalizer should also pass format and context to isAllowedAttribute

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | found while working on https://github.com/symfony/symfony/pull/30888
| License       | MIT
| Doc PR        | -

the context and format are optional parameters to `isAllowedAttribute`, but should be forwarded. due to this omission, the PropertyNormalizer was ignoring the 'attributes' context option (and does in version 4 also ignore the 'ignore_attributes' context option - that one is a property on the normalizer class in version 3 and therefore not ignored here)

Commits
-------

13e2fb735d property normalizer should also pass format and context to isAllowedAttribute
This commit is contained in:
Nicolas Grekas 2019-04-11 13:03:39 +02:00
commit 2a1137a05c
1 changed files with 1 additions and 1 deletions

View File

@ -102,7 +102,7 @@ class PropertyNormalizer extends AbstractObjectNormalizer
do {
foreach ($reflectionObject->getProperties() as $property) {
if (!$this->isAllowedAttribute($reflectionObject->getName(), $property->name)) {
if (!$this->isAllowedAttribute($reflectionObject->getName(), $property->name, $format, $context)) {
continue;
}