bug #27365 [Serializer] Check the value of enable_max_depth if defined (dunglas)

This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] Check the value of enable_max_depth if defined

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

Because it confuses some users that `['enable_max_depth' => false]` actually triggers the check.

Commits
-------

e88e0f30f1 [Serializer] Check the value of enable_max_depth if defined
This commit is contained in:
Nicolas Grekas 2018-05-25 16:39:07 +02:00
commit cb106fa2ff

View File

@ -331,6 +331,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
{
if (
!isset($context[static::ENABLE_MAX_DEPTH]) ||
!$context[static::ENABLE_MAX_DEPTH] ||
!isset($attributesMetadata[$attribute]) ||
null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth()
) {