-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Proxy does not work well with inheritance #60765
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
this looks weird, as it does not look like the service is configured as lazy here, and so I don't see why we would validate a proxy class. |
And RepackedApplication is also not overriding anything. /cc @nicolas-grekas |
The application is marked as Lazy
Indeed, I tried to make the reproducer as small as possible ! This code used to work. I suspect the issue comes from PHP! |
I may have found the culprit. When I dumped the compiled compiler I get
Note I editer symfony to hardcode RepackedApplication in my service definition, and it worked! So I suspect two things
|
I manage to make a reproducer as smaller as possible (I guess) <?php
class Application
{
public function __construct(
private string $name = 'my-app',
) {}
public function getName(): string
{
return $this->name;
}
}
class RepackedApplication extends Application
{
}
$application = new ReflectionClass(Application::class)->newLazyProxy(fn () => new RepackedApplication());
$application->getName(); I ran it on https://3v4l.org/TfgGE, and it's always the same error. So PHP may have not changed?! Should I open an issue on PHP.net too ? |
this is because you don't make the service lazy. You make only the autowired argument lazy, which creates a lazy proxy based on the autowired type (which is the application type). |
Uh oh!
There was an error while loading. Please reload this page.
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
How to reproduce
I made a reproducer, available in the following repo
I also tried the following line, instead of the faulty line:
The text was updated successfully, but these errors were encountered: