Commit 3dc65515 authored by Sascha Egerer's avatar Sascha Egerer Committed by Oliver Bartsch
Browse files

[BUGFIX] Use configuration context for placeholders in YAML import

The placeholder replacement in the yaml import method must receive
the current configuration context to be able to replace placeholders
with values that are already configured instead of the subvalues of
the import statement.

Resolves: #92956
Releases: main, 11.5
Change-Id: I4766bf1e6d268bb4c1bdd24e638c9b5056e600b8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66946


Tested-by: default avatarDaniel Goerz <daniel.goerz@b13.com>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarDaniel Goerz <daniel.goerz@b13.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
parent 73ed5173
......@@ -160,7 +160,7 @@ class YamlFileLoader implements LoggerAwareInterface
}
foreach ($content['imports'] as $import) {
try {
$import = $this->processPlaceholders($import, $import);
$import = $this->processPlaceholders($import, $content);
$importedContent = $this->loadAndParse($import['resource'], $fileName);
// override the imported content with the one from the current file
$content = ArrayUtility::replaceAndAppendScalarValuesRecursive($importedContent, $content);
......
imports:
- { resource: '%settings.dynamicOption%.yml' }
settings:
dynamicOption: 'Foo'
......@@ -290,6 +290,25 @@ betterthanbefore: \'%env(foo)%\'
self::assertSame($expected, $output);
}
/**
* Method checking for imports with placeholder values in the file name
* @test
*/
public function loadWithImportAndPlaceholderInFileName(): void
{
$loader = new YamlFileLoader();
$output = $loader->load(__DIR__ . '/Fixtures/Placeholder/Berta.yml');
$expected = [
'loadedWithPlaceholder' => 1,
'settings' => [
'dynamicOption' => 'Foo',
],
];
self::assertSame($expected, $output);
}
public function loadWithEnvVarDataProvider(): array
{
return [
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment