-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Problem with the cache warmer: Cannot redeclare class Event #29216
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
Comments
Having op-cache, I don't think you need to be using that class cache in the first place. You should be able to safely disable it. |
If you have problems with this class cache, I can also suggest to remove it. see #20668 |
Since we're still on php5.6 for now, I think we still profit from the cache. Or not? We still had some classes without namespace and migrated them to classes with Namespace, and included a Instead of relying on the fallback, we simply changed all references to the new Classnames and removed the old files. Doing that, it works now, but I'm still not sure why that caused the Event class to be written into |
Closing this issue because, as explained in the last comment, it looks like some temporary issue caused by introducing namespaces in some classes. Thanks. |
Symfony version(s) affected: 3.4.18 with php 5.6
Description
After clearing the cache, when trying to access any web page of the application, the following Fatal Error occurs:
Fatal error: Cannot redeclare class Symfony\Component\EventDispatcher\Event in ./var/cache/prod/classes.php on line 4471
. This happens only in prod environment.When clearing the cache, the file classes.php is created and contains the class
Symfony\Component\EventDispatcher\Event
, which seems to be unwanted, because it's already been loaded from vendor.When deleting the file
classes.php
from var/cache/prod/ and making the cache writable for apache, the automatically generated file does NOT contain the Event class and everything works.How to reproduce
I'm not sure what changed in the last couple of weeks, when I was still on 3.4.17 it worked, but simply changing the version in composer.json back to 3.4.17 did not solve the problem.
Possible Solution
I think when creating the cache from command line, the class Event for some reason already exists and the warmer takes all the declared classes and puts them in to classes.php. I don't know why from command line and only in prod environment the class exists but otherwise not.
The text was updated successfully, but these errors were encountered: