Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Description
Symfony version(s) affected
7.3.4
Description
I have a service class with a dependency ofTokenStorageInterface marked as lazy. This worked in the past. But after the update from v7.3.3 to v7.3.4 this breaks.
Here's my simplified class:
<?phpnamespaceApp\Extension\Serializer\Normalizer;useSymfony\Component\DependencyInjection\Attribute\Autowire;useSymfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;class ProfileNormalizer{publicfunction__construct( #[Autowire(lazy:true)]privatereadonlyTokenStorageInterface$tokenStorage, ) {}}
The responsible commit is002d735 with ththe change insrc/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
This results in theLazyServiceDumper trying to create a lazy proxy forSymfony\Component\Security\Core\Authentication\Token\Storage\UsageTrackingTokenStorage. This fails because is is final.
Previously the container definition was created for the interface and not the service which is aliased by the interface. So this is a bc issue.
How to reproduce
Checkout this reproduce project:https://github.com/stollr/symfony-lazy-proxy-bug-reproducer
and executephp8.3 /usr/local/bin/composer install.
This issue isnot reproducable with PHP 8.4. So you need to verify it with PHP 8.3.
Possible Solution
No response
Additional Context
No response