Skip to content

Commit eddf359

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: fixed test [Request] Ignore invalid IP addresses sent by proxies [EventDispatcher] TraceableEventDispatcher resets listener priorities Throw for missing container extensions [TwigBridge] add missing unit tests (AppVariable) Able to load big xml files with DomCrawler fixed typo [Form] Fix constraints could be null if not set [Finder] Check PHP version before applying a workaround for a PHP bug fixed CS add defaultNull to version sort bundles in config:dump-reference command Fixer findings. Profiler CSS position conflicts with JS detection [Translation][Writer] avoid calling setBackup if the dumper is not an instance of FileDumper. [FrameworkBundle] Compute the kernel root hash only one time
2 parents 887f9d1 + 2f5f1ed commit eddf359

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

Command/AbstractConfigCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ protected function findExtension($name)
5454
$bundles = $this->initializeBundles();
5555
foreach ($bundles as $bundle) {
5656
if ($name === $bundle->getName()) {
57+
if (!$bundle->getContainerExtension()) {
58+
throw new \LogicException(sprintf('Bundle "%s" does not have a container extension.', $name));
59+
}
60+
5761
return $bundle->getContainerExtension();
5862
}
5963

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
392392
->fixXmlConfig('base_url')
393393
->children()
394394
->scalarNode('version')
395+
->defaultNull()
395396
->beforeNormalization()
396397
->ifTrue(function ($v) { return '' === $v; })
397398
->then(function ($v) { return; })

DependencyInjection/FrameworkExtension.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class FrameworkExtension extends Extension
3838
private $translationConfigEnabled = false;
3939
private $sessionConfigEnabled = false;
4040

41+
/**
42+
* @var string|null
43+
*/
44+
private $kernelRootHash;
45+
4146
/**
4247
* Responds to the app.config configuration parameter.
4348
*
@@ -767,7 +772,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
767772
if (isset($config['cache'])) {
768773
$container->setParameter(
769774
'validator.mapping.cache.prefix',
770-
'validator_'.hash('sha256', $container->getParameter('kernel.root_dir'))
775+
'validator_'.$this->getKernelRootHash($container)
771776
);
772777

773778
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
@@ -943,7 +948,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
943948
if (isset($config['cache']) && $config['cache']) {
944949
$container->setParameter(
945950
'serializer.mapping.cache.prefix',
946-
'serializer_'.hash('sha256', $container->getParameter('kernel.root_dir'))
951+
'serializer_'.$this->getKernelRootHash($container)
947952
);
948953

949954
$container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument(
@@ -978,6 +983,22 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild
978983
}
979984
}
980985

986+
/**
987+
* Gets a hash of the kernel root directory.
988+
*
989+
* @param ContainerBuilder $container
990+
*
991+
* @return string
992+
*/
993+
private function getKernelRootHash(ContainerBuilder $container)
994+
{
995+
if (!$this->kernelRootHash) {
996+
$this->kernelRootHash = hash('sha256', $container->getParameter('kernel.root_dir'));
997+
}
998+
999+
return $this->kernelRootHash;
1000+
}
1001+
9811002
/**
9821003
* Returns the base path for the XSD files.
9831004
*

0 commit comments

Comments
 (0)