Skip to content

Commit 2810e72

Browse files
Merge branch '3.2'
* 3.2: (51 commits) [FrameworkBundle] [Workflow] Fix service marking store configuration Fix merge [Validator] add class name to the cache key [Serializer] Remove AbstractObjectNormalizer::isAttributeToNormalize Throw less misleading exception when property access not found [Twig] Fix deprecations with Twig 1.29 [FrameworkBundle] Fix validation cache warmer with failing or missing classes Fixed typo [FrameworkBundle] Removed the kernel.debug parameter from the cache pool namespace seed Fix email address fix the docblock in regard to the role argument [Bridge\Twig] Trigger deprecation when using FormExtension::$renderer Don't use the "app" global variable in the profiler [VarDumper] fix tests when xdebug is enabled Fix merge FIXED NON EXISTING TYPE DECLARATION [Form] Add failing test for data collector bug [Cache] Fix dumping SplDoublyLinkedList iter mode [Form] Fix FormDataCollector Ignore missing 'debug.file_link_formatter' service in Debug and Twig bundles ...
2 parents af9cfe7 + 2309ec5 commit 2810e72

File tree

16 files changed

+117
-16
lines changed

16 files changed

+117
-16
lines changed

CacheWarmer/AnnotationsCacheWarmer.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,19 @@ public function warmUp($cacheDir)
6666

6767
$arrayPool = new ArrayAdapter(0, false);
6868
$reader = new CachedReader($this->annotationReader, new DoctrineProvider($arrayPool));
69-
70-
foreach ($annotatedClasses as $class) {
71-
$this->readAllComponents($reader, $class);
69+
$throwingAutoloader = function ($class) { throw new \ReflectionException(sprintf('Class %s does not exist', $class)); };
70+
spl_autoload_register($throwingAutoloader);
71+
72+
try {
73+
foreach ($annotatedClasses as $class) {
74+
try {
75+
$this->readAllComponents($reader, $class);
76+
} catch (\ReflectionException $e) {
77+
// ignore failing reflection
78+
}
79+
}
80+
} finally {
81+
spl_autoload_unregister($throwingAutoloader);
7282
}
7383

7484
$values = $arrayPool->getValues();

CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,23 @@ public function warmUp($cacheDir)
6666
$loaders = $this->validatorBuilder->getLoaders();
6767
$metadataFactory = new LazyLoadingMetadataFactory(new LoaderChain($loaders), new Psr6Cache($arrayPool));
6868

69-
foreach ($this->extractSupportedLoaders($loaders) as $loader) {
70-
foreach ($loader->getMappedClasses() as $mappedClass) {
71-
if ($metadataFactory->hasMetadataFor($mappedClass)) {
72-
$metadataFactory->getMetadataFor($mappedClass);
69+
$throwingAutoloader = function ($class) { throw new \ReflectionException(sprintf('Class %s does not exist', $class)); };
70+
spl_autoload_register($throwingAutoloader);
71+
72+
try {
73+
foreach ($this->extractSupportedLoaders($loaders) as $loader) {
74+
foreach ($loader->getMappedClasses() as $mappedClass) {
75+
try {
76+
if ($metadataFactory->hasMetadataFor($mappedClass)) {
77+
$metadataFactory->getMetadataFor($mappedClass);
78+
}
79+
} catch (\ReflectionException $e) {
80+
// ignore failing reflection
81+
}
7382
}
7483
}
84+
} finally {
85+
spl_autoload_unregister($throwingAutoloader);
7586
}
7687

7788
$values = $arrayPool->getValues();

Command/ConfigDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8080

8181
$this->validateConfiguration($extension, $configuration);
8282

83-
$configs = $container->getParameterBag()->resolveValue($configs);
83+
$configs = $container->resolveEnvPlaceholders($container->getParameterBag()->resolveValue($configs));
8484

8585
$processor = new Processor();
8686
$config = $processor->processConfiguration($configuration, $configs);

Command/ContainerDebugCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Console\Style\SymfonyStyle;
2020
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2121
use Symfony\Component\DependencyInjection\ContainerBuilder;
22+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
2223
use Symfony\Component\Config\FileLocator;
2324

2425
/**
@@ -96,7 +97,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
9697
$object = $this->getContainerBuilder();
9798

9899
if ($input->getOption('parameters')) {
99-
$object = $object->getParameterBag();
100+
$parameters = array();
101+
foreach ($object->getParameterBag()->all() as $k => $v) {
102+
$parameters[$k] = $object->resolveEnvPlaceholders($v);
103+
}
104+
$object = new ParameterBag($parameters);
100105
$options = array();
101106
} elseif ($parameter = $input->getOption('parameter')) {
102107
$options = array('parameter' => $parameter);

Console/Descriptor/Descriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function describe(OutputInterface $output, $object, array $options = arra
5757
$this->describeContainerService($this->resolveServiceDefinition($object, $options['id']), $options);
5858
break;
5959
case $object instanceof ContainerBuilder && isset($options['parameter']):
60-
$this->describeContainerParameter($object->getParameter($options['parameter']), $options);
60+
$this->describeContainerParameter($object->resolveEnvPlaceholders($object->getParameter($options['parameter'])), $options);
6161
break;
6262
case $object instanceof ContainerBuilder:
6363
$this->describeContainerServices($object, $options);

DependencyInjection/Compiler/CachePoolPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function process(ContainerBuilder $container)
3434
} else {
3535
$seed = '_'.$container->getParameter('kernel.root_dir');
3636
}
37-
$seed .= '.'.$container->getParameter('kernel.name').'.'.$container->getParameter('kernel.environment').'.'.$container->getParameter('kernel.debug');
37+
$seed .= '.'.$container->getParameter('kernel.name').'.'.$container->getParameter('kernel.environment');
3838

3939
$aliases = $container->getAliases();
4040
$attributes = array(

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
268268
->thenInvalid('"type" and "service" cannot be used together.')
269269
->end()
270270
->validate()
271-
->ifTrue(function ($v) { return isset($v['arguments']) && isset($v['service']); })
271+
->ifTrue(function ($v) { return !empty($v['arguments']) && isset($v['service']); })
272272
->thenInvalid('"arguments" and "service" cannot be used together.')
273273
->end()
274274
->end()

Routing/Router.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ private function resolve($value)
146146
return '%%';
147147
}
148148

149+
if (preg_match('/^env\(\w+\)$/', $match[1])) {
150+
throw new RuntimeException(sprintf('Using "%%%s%%" is not allowed in routing configuration.', $match[1]));
151+
}
152+
149153
$resolved = $container->getParameter($match[1]);
150154

151155
if (is_string($resolved) || is_numeric($resolved)) {

Tests/DependencyInjection/Compiler/CachePoolPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testNamespaceArgumentIsReplaced()
4545

4646
$this->cachePoolPass->process($container);
4747

48-
$this->assertSame('C42Pcl9VBJ', $cachePool->getArgument(0));
48+
$this->assertSame('D07rhFx97S', $cachePool->getArgument(0));
4949
}
5050

5151
public function testArgsAreReplaced()
@@ -69,7 +69,7 @@ public function testArgsAreReplaced()
6969

7070
$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
7171
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
72-
$this->assertSame('KO3xHaFEZU', $cachePool->getArgument(1));
72+
$this->assertSame('itantF+pIq', $cachePool->getArgument(1));
7373
$this->assertSame(3, $cachePool->getArgument(2));
7474
}
7575

Tests/DependencyInjection/Fixtures/php/workflows.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,23 @@
8888
),
8989
),
9090
),
91+
'service_marking_store_workflow' => array(
92+
'marking_store' => array(
93+
'service' => 'workflow_service',
94+
),
95+
'supports' => array(
96+
FrameworkExtensionTest::class,
97+
),
98+
'places' => array(
99+
'first',
100+
'last',
101+
),
102+
'transitions' => array(
103+
'go' => array(
104+
'from' => 'first',
105+
'to' => 'last',
106+
),
107+
),
108+
),
91109
),
92110
));

0 commit comments

Comments
 (0)