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

Argument must be of type EventSubscriber, CleanListener given #1401

Closed
acirulis opened this issue Aug 22, 2023 · 5 comments
Closed

Argument must be of type EventSubscriber, CleanListener given #1401

acirulis opened this issue Aug 22, 2023 · 5 comments

Comments

@acirulis
Copy link

Bug Report

Q A
BC Break yes
Bundle version 2.2.0
Symfony version 6.2.13
PHP version 8.1

Summary

After recent composer upgrade project fails with following error while running tests:

TypeError: Doctrine\Common\EventManager::addEventSubscriber(): Argument #1 ($subscriber) must be of type Doctrine\Common\EventSubscriber, Vich\UploaderBundle\EventListener\Doctrine\CleanListener given, called in /var/www/html/api/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php on line 193

/var/www/html/api/vendor/doctrine/event-manager/src/EventManager.php:114
/var/www/html/api/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php:193
/var/www/html/api/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php:105
/var/www/html/api/vendor/doctrine/dbal/src/Connection.php:384
/var/www/html/api/vendor/doctrine/dbal/src/Connection.php:1652
/var/www/html/api/vendor/doctrine/dbal/src/Connection.php:1079
/var/www/html/api/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:771
/var/www/html/api/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:241
/var/www/html/api/vendor/symfony/doctrine-bridge/Security/User/EntityUserProvider.php:54
/var/www/html/api/vendor/symfony/security-http/Authenticator/Passport/Badge/UserBadge.php:79
/var/www/html/api/vendor/symfony/security-http/Authenticator/Passport/Passport.php:56
/var/www/html/api/vendor/symfony/security-http/EventListener/UserCheckerListener.php:42
/var/www/html/api/vendor/symfony/event-dispatcher/EventDispatcher.php:246
/var/www/html/api/vendor/symfony/event-dispatcher/EventDispatcher.php:206
/var/www/html/api/vendor/symfony/event-dispatcher/EventDispatcher.php:56
/var/www/html/api/vendor/symfony/security-http/Authentication/AuthenticatorManager.php:176
/var/www/html/api/vendor/symfony/security-http/Authentication/AuthenticatorManager.php:154
/var/www/html/api/vendor/symfony/security-http/Authentication/AuthenticatorManager.php:136
/var/www/html/api/vendor/symfony/security-http/Firewall/AuthenticatorManagerListener.php:40
/var/www/html/api/vendor/symfony/security-http/Firewall/AbstractListener.php:26
/var/www/html/api/vendor/symfony/security-bundle/Security/LazyFirewallContext.php:60
/var/www/html/api/vendor/symfony/security-http/Firewall.php:116
/var/www/html/api/vendor/symfony/security-http/Firewall.php:92
/var/www/html/api/vendor/symfony/event-dispatcher/EventDispatcher.php:246
/var/www/html/api/vendor/symfony/event-dispatcher/EventDispatcher.php:206
/var/www/html/api/vendor/symfony/event-dispatcher/EventDispatcher.php:56
/var/www/html/api/vendor/symfony/http-kernel/HttpKernel.php:139
/var/www/html/api/vendor/symfony/http-kernel/HttpKernel.php:74
/var/www/html/api/vendor/symfony/http-kernel/Kernel.php:184
/var/www/html/api/vendor/symfony/http-kernel/HttpKernelBrowser.php:63
/var/www/html/api/vendor/symfony/framework-bundle/KernelBrowser.php:167
/var/www/html/api/vendor/symfony/browser-kit/AbstractBrowser.php:370
/var/www/html/api/vendor/api-platform/core/src/Symfony/Bundle/Test/Client.php:116
...

Current behavior

Error shown above started to appear after generic composer update, which includes following updates, which may be relevant:

vich/uploader-bundle from 2.1.1 to 2.2.0
doctrine/doctrine-bundle from 2.10.0 to 2.10.2
doctrine/dbal from 3.6.3 to 3.6.6
doctrine/orm from 2.15.2 to 2.16.1
symfony/* from 6.2.10 to 6.2.13
api-platform/core from 3.1.12 to 3.1.14

Please let me know if any other debug info is necessary. Thanks!

@garak
Copy link
Collaborator

garak commented Aug 22, 2023

What's the context? I.e., what's the erroring test doing?

@acirulis
Copy link
Author

acirulis commented Aug 22, 2023

Testing API endpoints - first call for every endpoint is session authentication (POST), which fails with error above. Every endpoint fails with same error, regardless of resource having any uploadable fields.

@garak
Copy link
Collaborator

garak commented Aug 22, 2023

Symfony 6.2 is currently unmaintained, can you upgrade to 6.3?

@acirulis
Copy link
Author

Ok, problem fixed with 6.3 upgrade! Thanks. Composer.json requires ^6.0, though, maybe can be changed to ^6.3?

@garak
Copy link
Collaborator

garak commented Aug 22, 2023

It's not worth the effort of changing the minor version each time.
The docs already state that unmaintained Symfony versions are tentatively supported, but without active support in this bundle.

@garak garak closed this as completed Aug 22, 2023
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