Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd9dd43

Browse filesBrowse files
committed
[FrameworkBundle] Fixed issue when a parameter container a '%'
On my computer: ``` dump(get_cfg_var('xdebug.file_link_format')); "subl://%f:%l" ``` When I ran `bin/console debug:config framework` I got this exception: ``` In ParameterBag.php line 100: [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException] The parameter "templating.helper.code.file_link_format" has a dependency on a non-existent parameter "f:". Exception trace: () at /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:100 ... ``` This issue was introduced [here](https://github.com/symfony/symfony/pull/27684/files#diff-b3847149480405e1de881530b4c75ab5L212)
1 parent 4f290d7 commit cd9dd43
Copy full SHA for cd9dd43

File tree

2 files changed

+16
-8
lines changed
Filter options

2 files changed

+16
-8
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,12 @@ protected function getContainerBuilder()
224224
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
225225
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
226226
$container = $buildContainer();
227+
$container->getCompilerPassConfig()->setRemovingPasses([]);
228+
$container->compile();
227229
} else {
228230
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
229-
$container->setParameter('container.build_hash', $hash = ContainerBuilder::hash(__METHOD__));
230-
$container->setParameter('container.build_id', hash('crc32', $hash.time()));
231231
}
232232

233-
$container->getCompilerPassConfig()->setRemovingPasses([]);
234-
$container->compile();
235-
236233
return $this->containerBuilder = $container;
237234
}
238235

‎src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,27 @@ public static function getClassDescription(string $class, string &$resolvedClass
322322

323323
private function getContainerEnvVars(ContainerBuilder $container): array
324324
{
325+
$bag = $container->getParameterBag();
326+
$getDefaultParamter = function($name) {
327+
return parent::get($name);
328+
};
329+
$getDefaultParamter = $getDefaultParamter->bindTo($bag, get_class($bag));
330+
331+
$file = file_get_contents($container->getParameter('debug.container.dump'));
332+
333+
preg_match_all('{%env\((.*)\)%}', $file, $envVars);
334+
$envVars = array_unique($envVars[1]);
335+
325336
$getEnvReflection = new \ReflectionMethod($container, 'getEnv');
326337
$getEnvReflection->setAccessible(true);
327-
$envs = [];
328-
foreach (array_keys($container->getEnvCounters()) as $env) {
338+
339+
foreach ($envVars as $env) {
329340
$processor = 'string';
330341
if (false !== $i = strrpos($name = $env, ':')) {
331342
$name = substr($env, $i + 1);
332343
$processor = substr($env, 0, $i);
333344
}
334-
$defaultValue = ($hasDefault = $container->hasParameter("env($name)")) ? $container->getParameter("env($name)") : null;
345+
$defaultValue = ($hasDefault = $container->hasParameter("env($name)")) ? $getDefaultParamter("env($name)") : null;
335346
if (false === ($runtimeValue = $_ENV[$name] ?? $_SERVER[$name] ?? getenv($name))) {
336347
$runtimeValue = null;
337348
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.