Skip to content

[DependencyInjection] Proxy does not work well with inheritance #60765

Open
@lyrixx

Description

@lyrixx

Symfony version(s) affected

all?

Description

I have an application (castor) that recently has stopped building.

The failure is only with PHP 8.4. We use Symfony 7.2.* but it's broken also on Symfony 7.3

I get the following error, when the application starts

The real instance class RepackedApplication is not compatible with the proxy class App\Application. The proxy must be a instance of the same class as the real instance, or a sub-class with no additional properties, and no overrides of the __destructor or __clone methods

How to reproduce

I made a reproducer, available in the following repo

I also tried the following line, instead of the faulty line:

$services->get(Application::class)->class(RepackedApplication::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