Skip to content

Invalid lazy load proxy generation #27537

Closed
@speller

Description

@speller

Symfony version(s) affected: 4.1.0

Description
When two services with different names are implemented by the same class the compiled container become broken with PHP fatal error.

How to reproduce

  1. Create the following services declaration:
        <service id="bar" class="foo" lazy="true"/>
        <service id="baz" class="foo" lazy="true"/>
  1. Create empty class definition class foo {}.
  2. Compile the container and run compiled version.

Expected: Normal lazy-loaded operation.

Actual:

Fatal error: Cannot declare class foo_40d7466, because the name is already in use in path-to-container\container-name.php on line 13706

Possible Solution
Pass service id to the hash suffinx generator function or don't duplicate definition of the same proxied class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions