Skip to content

Commit 2f5f1ed

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: fixed test [Request] Ignore invalid IP addresses sent by proxies 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. [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 412809f + 5e44e95 commit 2f5f1ed

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
@@ -596,6 +596,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
596596
->fixXmlConfig('base_url')
597597
->children()
598598
->scalarNode('version')
599+
->defaultNull()
599600
->beforeNormalization()
600601
->ifTrue(function ($v) { return '' === $v; })
601602
->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
*
@@ -792,7 +797,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
792797
if (isset($config['cache'])) {
793798
$container->setParameter(
794799
'validator.mapping.cache.prefix',
795-
'validator_'.hash('sha256', $container->getParameter('kernel.root_dir'))
800+
'validator_'.$this->getKernelRootHash($container)
796801
);
797802

798803
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
@@ -981,7 +986,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
981986
if (isset($config['cache']) && $config['cache']) {
982987
$container->setParameter(
983988
'serializer.mapping.cache.prefix',
984-
'serializer_'.hash('sha256', $container->getParameter('kernel.root_dir'))
989+
'serializer_'.$this->getKernelRootHash($container)
985990
);
986991

987992
$container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument(
@@ -1016,6 +1021,22 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild
10161021
}
10171022
}
10181023

1024+
/**
1025+
* Gets a hash of the kernel root directory.
1026+
*
1027+
* @param ContainerBuilder $container
1028+
*
1029+
* @return string
1030+
*/
1031+
private function getKernelRootHash(ContainerBuilder $container)
1032+
{
1033+
if (!$this->kernelRootHash) {
1034+
$this->kernelRootHash = hash('sha256', $container->getParameter('kernel.root_dir'));
1035+
}
1036+
1037+
return $this->kernelRootHash;
1038+
}
1039+
10191040
/**
10201041
* Returns the base path for the XSD files.
10211042
*

0 commit comments

Comments
 (0)