Skip to content

Commit d278f8a

Browse files
Merge branch '4.1'
* 4.1: SCA: removed unused variables Remove duplicate condition fix useless space in docblock remove unneeded tearDown method [Intl] Update the ICU data to 63.1 [FrameworkBundle] Fix broken exception message [Messenger] send using the routing_key for AMQP transport also clean away the NO_AUTO_CACHE_CONTROL_HEADER if we have no session [TwigBundle] Fix usage of TwigBundle without FrameworkBundle Revert "fixed CS" [Serializer] Reduce class discriminator overhead Skip empty proxy code [Security] Fix "exclude-from-classmap" [Security] Removed unsed trait import [Config] Fix @method annotation add missing double-quotes to extra_fields output message [DI] Default undefined env to empty string during compile Convert InsufficientAuthenticationException to HttpException
2 parents 7ac0b2a + 11872a4 commit d278f8a

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

Compiler/ValidateEnvPlaceholdersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function process(ContainerBuilder $container)
4848
foreach ($resolvingBag->getEnvPlaceholders() + $resolvingBag->getUnusedEnvPlaceholders() as $env => $placeholders) {
4949
$values = array();
5050
if (false === $i = strpos($env, ':')) {
51-
$default = $defaultBag->has("env($env)") ? $defaultBag->get("env($env)") : null;
51+
$default = $defaultBag->has("env($env)") ? $defaultBag->get("env($env)") : self::$typeFixtures['string'];
5252
$defaultType = null !== $default ? self::getType($default) : 'string';
5353
$values[$defaultType] = $default;
5454
} else {

ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ private function createService(Definition $definition, array &$inlineServices, $
11241124
}
11251125
}
11261126
} else {
1127-
$r = new \ReflectionClass($class = $parameterBag->resolveValue($definition->getClass()));
1127+
$r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass()));
11281128

11291129
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
11301130

Dumper/PhpDumper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@ private function generateProxyClasses()
403403
$alreadyGenerated[$class] = true;
404404
// register class' reflector for resource tracking
405405
$this->container->getReflectionClass($class);
406-
$proxyCode = "\n".$proxyDumper->getProxyCode($definition);
406+
if ("\n" === $proxyCode = "\n".$proxyDumper->getProxyCode($definition)) {
407+
continue;
408+
}
407409
if ($strip) {
408410
$proxyCode = "<?php\n".$proxyCode;
409411
$proxyCode = substr(Kernel::stripComments($proxyCode), 5);

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ private function checkDefinition($id, array $definition, $file)
802802
{
803803
if ($this->isLoadingInstanceof) {
804804
$keywords = self::$instanceofKeywords;
805-
} elseif ($throw = (isset($definition['resource']) || isset($definition['namespace']))) {
805+
} elseif (isset($definition['resource']) || isset($definition['namespace'])) {
806806
$keywords = self::$prototypeKeywords;
807807
} else {
808808
$keywords = self::$serviceKeywords;

Tests/Compiler/ValidateEnvPlaceholdersPassTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function testDefaultEnvWithoutPrefixIsValidatedInConfig()
4848
$container->registerExtension($ext = new EnvExtension());
4949
$container->prependExtensionConfig('env_extension', $expected = array(
5050
'float_node' => '%env(FLOATISH)%',
51+
'string_node' => '%env(UNDEFINED)%',
5152
));
5253

5354
$this->doProcess($container);
@@ -313,6 +314,14 @@ public function getConfigTreeBuilder()
313314
->arrayNode('simple_array_node')->end()
314315
->enumNode('enum_node')->values(array('a', 'b'))->end()
315316
->variableNode('variable_node')->end()
317+
->scalarNode('string_node')
318+
->validate()
319+
->ifTrue(function ($value) {
320+
return !\is_string($value);
321+
})
322+
->thenInvalid('%s is not a string')
323+
->end()
324+
->end()
316325
->end();
317326

318327
return $treeBuilder;

0 commit comments

Comments
 (0)