8000 Problem with the cache warmer: Cannot redeclare class Event · Issue #29216 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Problem with the cache warmer: Cannot redeclare class Event #29216
@LorisZ

Description

@LorisZ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0