Commit 2b9bbbaa authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[!!!][TASK] Enable natural ordering of YAML imports

A new feature flag "yamlImportsFollowDeclarationOrder"
was introduced with #92100 which was available in TYPO3 v10 and v11.

With TYPO3 v12.0 the feature is now always enabled.

Projects making heavy use of the ordering of the yaml
imports should by now be converted using the declaration
ordering includes.

Resolves: #98399
Related: #92100
Related: #96107
Releases: main
Change-Id: Ifad7a015b3e9c06c6d841715e92d97e5b73d3494
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75810


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 7be898ac
......@@ -62,6 +62,7 @@ class Features
protected array $alwaysActiveFeatures = [
// Enabled since v12.0 at any time.
'subrequestPageErrors',
'yamlImportsFollowDeclarationOrder',
'security.frontend.htmlSanitizeParseFuncDefault',
'runtimeDbQuotingOfTcaConfiguration',
// Enabled since v11.0 at any time.
......
......@@ -19,7 +19,6 @@ use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Yaml;
use TYPO3\CMS\Core\Configuration\Features;
use TYPO3\CMS\Core\Configuration\Loader\Exception\YamlFileLoadingException;
use TYPO3\CMS\Core\Configuration\Loader\Exception\YamlParseException;
use TYPO3\CMS\Core\Configuration\Processor\PlaceholderProcessorList;
......@@ -155,9 +154,8 @@ class YamlFileLoader implements LoggerAwareInterface
protected function processImports(array $content, ?string $fileName): array
{
if (isset($content['imports']) && is_array($content['imports'])) {
if (GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('yamlImportsFollowDeclarationOrder')) {
$content['imports'] = array_reverse($content['imports']);
}
// Reverse the order of imports to follow the order of the declarations, see #92100
$content['imports'] = array_reverse($content['imports']);
foreach ($content['imports'] as $import) {
try {
$import = $this->processPlaceholders($import, $content);
......
......@@ -73,7 +73,6 @@ return [
'redirects.hitCount' => false,
'security.backend.htmlSanitizeRte' => false,
'security.backend.enforceReferrer' => true,
'yamlImportsFollowDeclarationOrder' => false,
],
'createGroup' => '',
'sitename' => 'TYPO3',
......
......@@ -204,9 +204,6 @@ SYS:
description: 'If on, HTTP referrer headers are enforced for backend and install tool requests to mitigate
potential same-site request forgery attacks. The behavior can be disabled in case HTTP proxies filter
required `Referer` header. As this is a potential security risk, it is recommended to enable this option.'
yamlImportsFollowDeclarationOrder:
type: bool
description: 'If on, the YAML imports are imported in the order they are defined in the importing YAML configuration.'
availablePasswordHashAlgorithms:
type: array
description: 'A list of available password hash mechanisms. Extensions may register additional mechanisms here. This is usually not extended in LocalConfiguration.php.'
......
......@@ -19,9 +19,6 @@ return [
],
'SYS' => [
'sitename' => 'New TYPO3 site',
'features' => [
'yamlImportsFollowDeclarationOrder' => true,
],
'UTF8filesystem' => true,
],
];
......@@ -346,6 +346,7 @@ The following features are now always enabled:
- `runtimeDbQuotingOfTcaConfiguration`
- `subrequestPageErrors`
- `yamlImportsFollowDeclarationOrder`
The following features have been removed:
......
......@@ -141,9 +141,6 @@ options:
'betterthanbefore' => 1,
];
// Make sure, feature toggle is activated
$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['yamlImportsFollowDeclarationOrder'] = true;
// Accessible mock to $subject since getFileContents calls GeneralUtility methods
$subject = $this->getAccessibleMock(YamlFileLoader::class, ['getFileContents', 'getStreamlinedFileName']);
......
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