Skip to content

Commit 0692f3c

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: [Serializer] Fixed throwing exception with option JSON_PARTIAL_OUTPUT_ON_ERROR Tweaked some styles in the profiler tables Add type string to docblock for Process::setInput() [Security] Fail gracefully if the security token cannot be unserialized from the session [Form] AbstractLayoutTest - fix DOMDocument casing Run simple-phpunit with --no-suggest option [FrameworkBundle] Fix using "annotations.cached_reader" in after-removing passes bumped Symfony version to 3.3.16 updated VERSION for 3.3.15 updated CHANGELOG for 3.3.15 bumped Symfony version to 2.8.34 updated VERSION for 2.8.33 updated CHANGELOG for 2.8.33 bumped Symfony version to 2.7.41 updated VERSION for 2.7.40 update CONTRIBUTORS for 2.7.40 updated CHANGELOG for 2.7.40
2 parents 4188236 + e115c32 commit 0692f3c

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
16-
use Symfony\Component\DependencyInjection\Reference;
1716

1817
/**
1918
* @internal
@@ -29,14 +28,14 @@ public function process(ContainerBuilder $container)
2928
// "annotation_reader" at build time don't get any cache
3029
if ($container->hasDefinition('annotations.cached_reader')) {
3130
$reader = $container->getDefinition('annotations.cached_reader');
32-
$tags = $reader->getTags();
31+
$properties = $reader->getProperties();
3332

34-
if (isset($tags['annotations.cached_reader'][0]['provider'])) {
35-
if ($container->hasAlias($provider = $tags['annotations.cached_reader'][0]['provider'])) {
36-
$provider = (string) $container->getAlias($provider);
37-
}
33+
if (isset($properties['cacheProviderBackup'])) {
34+
$provider = $properties['cacheProviderBackup']->getValues()[0];
35+
unset($properties['cacheProviderBackup']);
36+
$reader->setProperties($properties);
3837
$container->set('annotations.cached_reader', null);
39-
$container->setDefinition('annotations.cached_reader', $reader->replaceArgument(1, new Reference($provider)));
38+
$container->setDefinition('annotations.cached_reader', $reader->replaceArgument(1, $provider));
4039
}
4140
}
4241
}

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Symfony\Component\Console\Application;
2929
use Symfony\Component\Console\Command\Command;
3030
use Symfony\Component\DependencyInjection\Alias;
31+
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
3132
use Symfony\Component\DependencyInjection\ChildDefinition;
3233
use Symfony\Component\DependencyInjection\ContainerBuilder;
3334
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -1386,7 +1387,8 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
13861387
$container
13871388
->getDefinition('annotations.cached_reader')
13881389
->replaceArgument(2, $config['debug'])
1389-
->addTag('annotations.cached_reader', array('provider' => $cacheService))
1390+
// temporary property to lazy-reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1391+
->setProperty('cacheProviderBackup', new ServiceClosureArgument(new Reference($cacheService)))
13901392
;
13911393
$container->setAlias('annotation_reader', 'annotations.cached_reader')->setPrivate(true);
13921394
$container->setAlias(Reader::class, new Alias('annotations.cached_reader', false));

FrameworkBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function build(ContainerBuilder $container)
102102
$container->addCompilerPass((new RegisterListenersPass())->setHotPathEvents($hotPathEvents), PassConfig::TYPE_BEFORE_REMOVING);
103103
$container->addCompilerPass(new TemplatingPass());
104104
$this->addCompilerPassIfExists($container, AddConstraintValidatorsPass::class, PassConfig::TYPE_BEFORE_REMOVING);
105-
$container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_BEFORE_REMOVING);
105+
$container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_AFTER_REMOVING, -255);
106106
$this->addCompilerPassIfExists($container, AddValidatorInitializersPass::class);
107107
$this->addCompilerPassIfExists($container, AddConsoleCommandPass::class);
108108
if (class_exists(TranslatorPass::class)) {

Tests/Functional/Bundle/TestBundle/TestBundle.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle;
1313

1414
use Symfony\Component\HttpKernel\Bundle\Bundle;
15+
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\AnnotationReaderPass;
1718
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\Config\CustomConfig;
@@ -27,6 +28,6 @@ public function build(ContainerBuilder $container)
2728

2829
$extension->setCustomConfig(new CustomConfig());
2930

30-
$container->addCompilerPass(new AnnotationReaderPass());
31+
$container->addCompilerPass(new AnnotationReaderPass(), PassConfig::TYPE_AFTER_REMOVING);
3132
}
3233
}

0 commit comments

Comments
 (0)