-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Symfony version(s) affected
7.3.4
Description
I have a service class with a dependency of TokenStorageInterface 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:
<?php
namespace App\Extension\Serializer\Normalizer;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class ProfileNormalizer
{
public function __construct(
#[Autowire(lazy: true)]
private readonly TokenStorageInterface $tokenStorage,
) {}
}The responsible commit is 002d735 with ththe change in src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
This results in the LazyServiceDumper trying to create a lazy proxy for Symfony\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 execute php8.3 /usr/local/bin/composer install.
This issue is not reproducable with PHP 8.4. So you need to verify it with PHP 8.3.
Possible Solution
No response
Additional Context
No response