-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Since I have installed FOSHttpCacheBundle I get a strange error on POST requests (when submitting any form):
Fatal error: Cannot redeclare class Symfony\Component\EventDispatcher\Event in C:\projects\acme\app\cache\dev\classes.php on line 2136
Call Stack:
0.0020 136568 1. {main}() C:\projects\acme\web\app_dev.php:0
0.0380 1908496 2. FOS\HttpCacheBundle\SymfonyCache\EventDispatchingHttpCache->handle() C:\projects\acme\web\app_dev.php:34
0.0380 1908952 3. Symfony\Component\HttpKernel\HttpCache\HttpCache->handle() C:\projects\acme\vendor\friendsofsymfony\http-cache-bundle\SymfonyCache\EventDispatchingHttpCache.php:122
0.0390 1928528 4. FOS\HttpCacheBundle\SymfonyCache\EventDispatchingHttpCache->invalidate() C:\projects\acme\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpCache\HttpCache.php:206
0.0410 1948712 5. Symfony\Component\HttpKernel\HttpCache\HttpCache->invalidate() C:\projects\acme\vendor\friendsofsymfony\http-cache-bundle\SymfonyCache\EventDispatchingHttpCache.php:161
0.0410 1948736 6. Symfony\Component\HttpKernel\HttpCache\HttpCache->pass() C:\projects\acme\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpCache\HttpCache.php:275
0.0410 1949016 7. Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache->forward() C:\projects\acme\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpCache\HttpCache.php:258
0.0410 1949176 8. Symfony\Component\HttpKernel\Kernel->boot() C:\projects\acme\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache.php:56
0.0410 1949240 9. Symfony\Component\HttpKernel\Kernel->doLoadClassCache() C:\projects\acme\app\bootstrap.php.cache:2408
0.0430 2034240 10. Symfony\Component\ClassLoader\ClassCollectionLoader::load() C:\projects\acme\app\bootstrap.php.cache:2573
0.1000 4173632 11. require_once('C:\projects\acme\app\cache\dev\classes.php') C:\projects\acme\vendor\symfony\symfony\src\Symfony\Component\ClassLoader\ClassCollectionLoader.php:91
Now, when I delete the cache folder via filesystem (not with app/console cache:clear) the next POST request works, but all next POST requests are failing again with the same error message.
But when I execute app/console cache:clear after removing the cache folder it seem to work on all requests.
I have already figured out that on POST requests the Symfony\Component\EventDispatcher\Event class is loaded via autoloading when an instance of CacheEvent is created in FOS\HttpCacheBundle\SymfonyCache\EventDispatchingHttpCache::invalidate. Later the Symfony HttpKernel boots and loads the class cache (the classes.php in the cache folder) which contains the Event class, too. This results in the mentioned redeclaration error.
What confuses me, is that the Event class is not compiled into classes.php when app/console cache:clear is executed after removing the cache folder.
Does anyone has a clue about this issue?