Skip to content

Commit c48f2d0

Browse files
Merge branch '3.2'
* 3.2: [Security] Fix test [Validator] phpize default option values test for the Validator component to be present [Serializer] Fix MaxDepth annotation exceptions [DependencyInjection] Fix on-invalid attribute type in xsd [FrameworkBundle] Fix PHP form templates on translatable attributes [VarDumper] Fix dumping by-ref variadics [Validator] add Indonesian translation fixed CS [config] Fix issue when key removed and left value only [HttpFoundation] Fix cookie to string conversion for raw cookies Fix misresolved parameters in debug:config on 3.2 [Console] fixed BC issue with static closures [TwigBundle] Config is now a hard dependency [FrameworkBundle] framework.annotations default should be true only if doctrine/annotations is installed [Security] AbstractVoter method supportsAttribute gives false positive if attribute is zero (0)
2 parents ea30f27 + f991e07 commit c48f2d0

File tree

7 files changed

+29
-6
lines changed

7 files changed

+29
-6
lines changed

Command/ConfigDebugCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8383
$configs = $container->resolveEnvPlaceholders($container->getParameterBag()->resolveValue($configs));
8484

8585
$processor = new Processor();
86-
$config = $processor->processConfiguration($configuration, $configs);
86+
$config = $container->resolveEnvPlaceholders($container->getParameterBag()->resolveValue($processor->processConfiguration($configuration, $configs)));
8787

8888
if (null === $path = $input->getArgument('path')) {
8989
$io->title(
@@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
105105

106106
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
107107

108-
$io->writeln(Yaml::dump($container->getParameterBag()->resolveValue($config), 10));
108+
$io->writeln(Yaml::dump($config, 10));
109109
}
110110

111111
private function compileContainer()
@@ -130,7 +130,7 @@ private function compileContainer()
130130
*
131131
* @return mixed
132132
*/
133-
private function getConfigForPath(array $config = array(), $path, $alias)
133+
private function getConfigForPath(array $config, $path, $alias)
134134
{
135135
$steps = explode('.', $path);
136136

DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
1313

14+
use Doctrine\Common\Annotations\Annotation;
1415
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1516
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1617
use Symfony\Component\Config\Definition\ConfigurationInterface;
@@ -602,7 +603,7 @@ private function addAnnotationsSection(ArrayNodeDefinition $rootNode)
602603
->children()
603604
->arrayNode('annotations')
604605
->info('annotation configuration')
605-
->canBeDisabled()
606+
->{class_exists(Annotation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
606607
->children()
607608
->scalarNode('cache')->defaultValue('php_array')->end()
608609
->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end()

DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,10 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
914914
return;
915915
}
916916

917+
if (!class_exists('Symfony\Component\Validator\Validation')) {
918+
throw new LogicException('Validation support cannot be enabled as the Validator component is not installed.');
919+
}
920+
917921
$loader->load('validator.xml');
918922

919923
$validatorBuilder = $container->getDefinition('validator.builder');

Resources/views/Form/button_attributes.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>" <?php if ($disabled): ?>disabled="disabled" <?php endif ?>
22
<?php foreach ($attr as $k => $v): ?>
3-
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
3+
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
44
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
55
<?php elseif ($v === true): ?>
66
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>

Resources/views/Form/widget_container_attributes.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php if (!empty($id)): ?>id="<?php echo $view->escape($id) ?>" <?php endif ?>
22
<?php foreach ($attr as $k => $v): ?>
3-
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
3+
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
44
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
55
<?php elseif ($v === true): ?>
66
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>

Tests/Functional/ConfigDebugCommandTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public function testDumpBundleOption()
4848
$this->assertContains('foo', $tester->getDisplay());
4949
}
5050

51+
public function testParametersValuesAreResolved()
52+
{
53+
$tester = $this->createCommandTester();
54+
$ret = $tester->execute(array('name' => 'framework'));
55+
56+
$this->assertSame(0, $ret, 'Returns 0 in case of success');
57+
$this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay());
58+
$this->assertContains('secret: test', $tester->getDisplay());
59+
}
60+
5161
public function testDumpUndefinedBundleOption()
5262
{
5363
$tester = $this->createCommandTester();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
imports:
22
- { resource: ../config/default.yml }
3+
4+
framework:
5+
secret: '%secret%'
6+
default_locale: '%env(LOCALE)%'
7+
8+
parameters:
9+
env(LOCALE): en
10+
secret: test

0 commit comments

Comments
 (0)