Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony4 jms 3.10 LazyEventDispatcher injects a wrong container #867

Open
lerminou opened this issue Sep 8, 2021 · 2 comments
Open

Symfony4 jms 3.10 LazyEventDispatcher injects a wrong container #867

lerminou opened this issue Sep 8, 2021 · 2 comments

Comments

@lerminou
Copy link

lerminou commented Sep 8, 2021

Q A
Bug report? yes

After a migration sf3 => sf4 and a jms 2 =>3 upgrade, my project is not working anymore.

Steps required to reproduce the problem

  1. install jms serializer bundle 3.10
  2. run a request

Expected Result

  • my response is well serialized

Actual Result

JMS\Serializer\EventDispatcher\LazyEventDispatcher::__construct(): Argument #1 ($container) must be of type Symfony\Component\DependencyInjection\ContainerInterface, Symfony\Component\DependencyInjection\Argument\ServiceLocator given, called in /home/dev/app/cache/dev/ContainerKtlYnhv/srcKernelDevDebugContainer.php on line 13876

It's working if I comment these lines in the file : vendor/jms/serializer-bundle/DependencyInjection/Compiler/RegisterEventListenersAndSubscribersPass.php

if (class_exists(ServiceLocatorTagPass::class)) {
            $serviceLocator = ServiceLocatorTagPass::register($container, $listenerServices);
            $container->getDefinition('jms_serializer.event_dispatcher')->replaceArgument(0, $serviceLocator);
        }
@goetas
Copy link
Collaborator

goetas commented Sep 8, 2021

it seems that you have updated the bundle, but what about jms/serializer library? which version are you using there?

@lerminou
Copy link
Author

lerminou commented Sep 8, 2021

here are all my jms dependencies from the new composer.lock:
"name": "jms/metadata", "version": "2.5.1",
"name": "jms/serializer", "version": "3.14.0",
"name": "jms/serializer-bundle", "version": "3.10.0",
"name": "jms/translation-bundle", "version": "1.6.0",
"name": "jms/i18n-routing-bundle", "version": "3.1.0",

and the symfony/dependency-injection package is in "version": "v4.4.27",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants