简体   繁体   中英

Uncaught TypeError: Argument 2 passed to Symfony\Component\EventDispatcher\EventDispatcher // Contao 4.7 & Symfony

We are using Contao 4.7.7 which depends on Symfony, for some reason we are receiving the following fatal error out of nothing, not sure how this one came up.

On this event: fos_http_cache.pre_handle the Kernel passes a wrong Event

How to solve this issue?

Fatal error: Uncaught TypeError: Argument 2 passed to Symfony\\Component\\EventDispatcher\\EventDispatcher::dispatch() must be an instance of Symfony\\Component\\EventDispatcher\\Event or null, instance of FOS\\HttpCache\\SymfonyCache\\CacheEvent given, called in /vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php on line 164 and defined in /vendor/symfony/event-dispatcher/EventDispatcher.php:37

Stack trace:

  1. /vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(164): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch('fos_http_cache....', Object(FOS\\HttpCache\\SymfonyCache\\CacheEvent))

  2. /vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(100): Contao\\ManagerBundle\\HttpKernel\\ContaoCache->dispatch('fos_http_cache....', Object(Symfony\\Component\\HttpFoundation\\Request), NULL, 1)

  3. /web/app.php(58): in vendor/symfony/event-dispatcher/EventDispatcher.php on line 37

This is a bug that occurs in Contao 4.7 with the most recent Symfony dependencies. You need to update to the most recent, currently supported Contao version (at the time of your post that would be Contao 4.8.5 ).

Contao 4.7 is not supported anymore. See the release plan for more information about the currently supported versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM