Monthly Archives: September 2013

Fix “Cannot redeclare class Symfony\…” in Symfony2 after upgrade

After upgrading from Symfony 2.2 to 2.3 I got this error in my application:

Fatal error: Cannot redeclare class Symfony\Component\HttpFoundation\FileBag in app/cache/prod/classes.php on line 1823

Another symptom was this error while trying to clear the cache for the prod environment:

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
The parameter "kernel.http_method_override" must be defined.

The process to solve this problem was:

1.- Remove the cache folder:

rm -rf app/cache/prod

2.- Then clear the cache for the prod environment:

php app/console cache:clear --env=prod --no-debug

Ref: