Closed
Description
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
- Create the following services declaration:
<service id="bar" class="foo" lazy="true"/>
<service id="baz" class="foo" lazy="true"/>
- Create empty class definition
class foo {}
. - 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.