Skip to content

[Serializer] Globally configured serializer context fails #44960

Closed
@norkunas

Description

@norkunas

Symfony version(s) affected

5.4.*

Description

Based on https://symfony.com/blog/new-in-symfony-5-4-serializer-improvements I need just to configure the serializer default context in config file but it fails.

How to reproduce

Just configure like in blog post:

framework:
    serializer:
        default_context:
            enable_max_depth: true

And I get:

In DefinitionErrorExceptionPass.php line 54:

  [Symfony\Component\DependencyInjection\Exception\RuntimeException]
  Invalid constructor argument 3 for service "serializer.normalizer.json_serializable": argument 1 must be defined before. Check your service definition.

Exception trace:
  at /vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:54
 Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() at /vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:82
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() at /vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:32
 Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() at /vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:47
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process() at /vendor/symfony/dependency-injection/Compiler/Compiler.php:82
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /vendor/symfony/dependency-injection/ContainerBuilder.php:757
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /vendor/symfony/http-kernel/Kernel.php:548
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /vendor/symfony/http-kernel/Kernel.php:789
 Symfony\Component\HttpKernel\Kernel->preBoot() at /vendor/symfony/http-kernel/Kernel.php:128
 Symfony\Component\HttpKernel\Kernel->boot() at /vendor/symfony/framework-bundle/Console/Application.php:168
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at /vendor/symfony/framework-bundle/Console/Application.php:74
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /vendor/autoload_runtime.php:35
 require_once() at bin/console:15

Possible Solution

N/A

Additional Context

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions