Skip to content

Commit 6cbb542

Browse files
Merge branch '5.4' into 6.0
* 5.4: Fix merge [HttpKernel] Guard against bad profile data Fix deprecations on PHP 8.2
2 parents 8fb3fff + af58c77 commit 6cbb542

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617

@@ -28,14 +29,18 @@ public function process(ContainerBuilder $container)
2829
// "annotation_reader" at build time don't get any cache
2930
foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) {
3031
$reader = $container->getDefinition($id);
32+
$reader->setPublic(false);
3133
$properties = $reader->getProperties();
3234

3335
if (isset($properties['cacheProviderBackup'])) {
3436
$provider = $properties['cacheProviderBackup']->getValues()[0];
3537
unset($properties['cacheProviderBackup']);
3638
$reader->setProperties($properties);
37-
$container->set($id, null);
38-
$container->setDefinition($id, $reader->replaceArgument(1, $provider));
39+
$reader->replaceArgument(1, $provider);
40+
} elseif (4 <= \count($arguments = $reader->getArguments()) && $arguments[3] instanceof ServiceClosureArgument) {
41+
$arguments[1] = $arguments[3]->getValues()[0];
42+
unset($arguments[3]);
43+
$reader->setArguments($arguments);
3944
}
4045
}
4146
}

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,9 +1594,10 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
15941594

15951595
$container
15961596
->getDefinition('annotations.cached_reader')
1597+
->setPublic(true) // set to false in AddAnnotationsCachedReaderPass
15971598
->replaceArgument(2, $config['debug'])
1598-
// temporary property to lazy-reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1599-
->setProperty('cacheProviderBackup', new ServiceClosureArgument(new Reference($cacheService)))
1599+
// reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1600+
->addArgument(new ServiceClosureArgument(new Reference($cacheService)))
16001601
->addTag('annotations.cached_reader')
16011602
;
16021603

0 commit comments

Comments
 (0)