Skip to content

Commit fdc2bb4

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: (26 commits) [Serializer] Fixed throwing exception with option JSON_PARTIAL_OUTPUT_ON_ERROR [HttpKernel] Fix session handling: decouple "save" from setting response "private" swap filter/function and package names [HttpFoundation] Always call proxied handler::destroy() in StrictSessionHandler [HttpKernel] Fix compile error when a legacy container is fresh again Add tests for the HttpKernel request collector and redirection via cookies Uses cookies to track the requests redirection 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.4.4 updated VERSION for 3.4.3 updated CHANGELOG for 3.4.3 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 ...
2 parents 7d80f8d + 0692f3c commit fdc2bb4

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;
@@ -1107,7 +1108,8 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
11071108
$container
11081109
->getDefinition('annotations.cached_reader')
11091110
->replaceArgument(2, $config['debug'])
1110-
->addTag('annotations.cached_reader', array('provider' => $cacheService))
1111+
// temporary property to lazy-reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1112+
->setProperty('cacheProviderBackup', new ServiceClosureArgument(new Reference($cacheService)))
11111113
;
11121114
$container->setAlias('annotation_reader', 'annotations.cached_reader')->setPrivate(true);
11131115
$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
@@ -94,7 +94,7 @@ public function build(ContainerBuilder $container)
9494
$container->addCompilerPass((new RegisterListenersPass())->setHotPathEvents($hotPathEvents), PassConfig::TYPE_BEFORE_REMOVING);
9595
$container->addCompilerPass(new TemplatingPass());
9696
$this->addCompilerPassIfExists($container, AddConstraintValidatorsPass::class, PassConfig::TYPE_BEFORE_REMOVING);
97-
$container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_BEFORE_REMOVING);
97+
$container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_AFTER_REMOVING, -255);
9898
$this->addCompilerPassIfExists($container, AddValidatorInitializersPass::class);
9999
$this->addCompilerPassIfExists($container, AddConsoleCommandPass::class);
100100
$this->addCompilerPassIfExists($container, 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)