diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-87594-HardenExtbase.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-87594-HardenExtbase.rst index 6d55f81d927d938becf1d2c7229dd76a3743365d..23f204339dc61e766e81858c72bf935c40d9ad88 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Breaking-87594-HardenExtbase.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-87594-HardenExtbase.rst @@ -44,6 +44,9 @@ While hardening Extbase classes, method signatures changed due to an enforced st - :php:`\TYPO3\CMS\Extbase\Error\Message::getArguments` - :php:`\TYPO3\CMS\Extbase\Error\Message::getTitle` - :php:`\TYPO3\CMS\Extbase\Error\Message::render` +- :php:`\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::getContentObject` +- :php:`\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::getConfiguration` +- :php:`\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::isFeatureEnabled` Impact diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-87603-ClassesUseStrictModeAndScarlarTypeHints.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-87603-ClassesUseStrictModeAndScarlarTypeHints.rst index cb6cb2e918acf8e6fcd379e8e2ac44d6e50063c8..bcc05b1a0f9e9b60ceb8924ba64575257fbfabbb 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Important-87603-ClassesUseStrictModeAndScarlarTypeHints.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Important-87603-ClassesUseStrictModeAndScarlarTypeHints.rst @@ -20,5 +20,9 @@ and their methods will force parameter types with scalar type hints: - :php:`\TYPO3\CMS\Extbase\Object\Container\Container` - :php:`\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap` - :php:`\TYPO3\CMS\Extbase\Service\ExtensionService` +- :php:`\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface` +- :php:`\TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager` +- :php:`\TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager` +- :php:`\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager` .. index:: Backend, PHP-API, ext:extbase diff --git a/typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php b/typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php index d729231d88a6615b07f176e3c2825af3afee0e62..c675c2115596364ac55c160c8f3a69c40d413ac9 100644 --- a/typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php +++ b/typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php @@ -1,4 +1,6 @@ <?php +declare(strict_types = 1); + namespace TYPO3\CMS\Extbase\Configuration; /* @@ -91,7 +93,7 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton /** * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */ - public function setContentObject(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject = null) + public function setContentObject(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject): void { $this->contentObject = $contentObject; } @@ -99,12 +101,9 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton /** * @return \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer|null */ - public function getContentObject() + public function getContentObject(): ?\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer { - if ($this->contentObject !== null) { - return $this->contentObject; - } - return null; + return $this->contentObject; } /** @@ -113,7 +112,7 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton * * @param array $configuration The new configuration */ - public function setConfiguration(array $configuration = []) + public function setConfiguration(array $configuration = []): void { // reset 1st level cache $this->configurationCache = []; @@ -128,11 +127,11 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton * The Extbase framework configuration HAS TO be retrieved using this method, as they are come from different places than the normal settings. * Framework configuration is, in contrast to normal settings, needed for the Extbase framework to operate correctly. * - * @param string $extensionName if specified, the configuration for the given extension will be returned (plugin.tx_extensionname) - * @param string $pluginName if specified, the configuration for the given plugin will be returned (plugin.tx_extensionname_pluginname) + * @param string|null $extensionName if specified, the configuration for the given extension will be returned (plugin.tx_extensionname) + * @param string|null $pluginName if specified, the configuration for the given plugin will be returned (plugin.tx_extensionname_pluginname) * @return array the Extbase framework configuration */ - public function getConfiguration($extensionName = null, $pluginName = null) + public function getConfiguration(?string $extensionName = null, ?string $pluginName = null): array { // 1st level cache $configurationCacheKey = strtolower(($extensionName ?: $this->extensionName) . '_' . ($pluginName ?: $this->pluginName)); @@ -145,15 +144,15 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton } // only merge $this->configuration and override switchableControllerActions when retrieving configuration of the current plugin if ($extensionName === null || $extensionName === $this->extensionName && $pluginName === $this->pluginName) { - $pluginConfiguration = $this->getPluginConfiguration($this->extensionName, $this->pluginName); + $pluginConfiguration = $this->getPluginConfiguration((string)$this->extensionName, (string)$this->pluginName); \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($pluginConfiguration, $this->configuration); - $pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions($this->extensionName, $this->pluginName); + $pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions((string)$this->extensionName, (string)$this->pluginName); if (isset($this->configuration['switchableControllerActions'])) { $this->overrideSwitchableControllerActions($pluginConfiguration, $this->configuration['switchableControllerActions']); } } else { - $pluginConfiguration = $this->getPluginConfiguration($extensionName, $pluginName); - $pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions($extensionName, $pluginName); + $pluginConfiguration = $this->getPluginConfiguration((string)$extensionName, (string)$pluginName); + $pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions((string)$extensionName, (string)$pluginName); } \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($frameworkConfiguration, $pluginConfiguration); // only load context specific configuration when retrieving configuration of the current plugin @@ -185,10 +184,12 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton $storagePid = -$storagePid; } }); - $frameworkConfiguration['persistence']['storagePid'] = $this->getRecursiveStoragePids( - implode(',', $storagePids), + $storagePids = $this->getRecursiveStoragePids( + $storagePids, (int)$frameworkConfiguration['persistence']['recursive'] ); + + $frameworkConfiguration['persistence']['storagePid'] = implode(',', $storagePids); } } // 1st level cache @@ -201,7 +202,7 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton * * @return array */ - protected function getExtbaseConfiguration() + protected function getExtbaseConfiguration(): array { $setup = $this->getTypoScriptSetup(); $extbaseConfiguration = []; @@ -214,9 +215,9 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton /** * Returns the default backend storage pid * - * @return string + * @return int */ - public function getDefaultBackendStoragePid() + public function getDefaultBackendStoragePid(): int { return self::DEFAULT_BACKEND_STORAGE_PID; } @@ -241,7 +242,7 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton * @param array &$frameworkConfiguration * @param array $switchableControllerActions */ - protected function overrideSwitchableControllerActions(array &$frameworkConfiguration, array $switchableControllerActions) + protected function overrideSwitchableControllerActions(array &$frameworkConfiguration, array $switchableControllerActions): void { $controllerAliasToClass = []; foreach ($frameworkConfiguration['controllerConfiguration'] as $controllerClass => $controllerConfiguration) { @@ -328,14 +329,14 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton * @param array $frameworkConfiguration The framework configuration until now * @return array context specific configuration which will override the configuration obtained by TypoScript */ - abstract protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration); + abstract protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration): array; /** * Returns TypoScript Setup array from current Environment. * * @return array the TypoScript setup */ - abstract public function getTypoScriptSetup(); + abstract public function getTypoScriptSetup(): array; /** * Returns the TypoScript configuration found in plugin.tx_yourextension_yourplugin / module.tx_yourextension_yourmodule @@ -345,7 +346,7 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton * @param string $pluginName in FE mode this is the specified plugin name, in BE mode this is the full module signature * @return array */ - abstract protected function getPluginConfiguration($extensionName, $pluginName = null); + abstract protected function getPluginConfiguration(string $extensionName, string $pluginName = null): array; /** * Returns the configured controller/action pairs of the specified plugin/module in the format @@ -358,15 +359,15 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton * @param string $pluginName in FE mode this is the specified plugin name, in BE mode this is the full module signature * @return array */ - abstract protected function getSwitchableControllerActions($extensionName, $pluginName); + abstract protected function getSwitchableControllerActions(string $extensionName, string $pluginName): array; /** * The implementation of the methods to return a list of storagePid that are below a certain * storage pid. * - * @param string $storagePid Storage PID to start at; multiple PIDs possible as comma-separated list + * @param array|int[] $storagePids Storage PIDs to start at; multiple PIDs possible as comma-separated list * @param int $recursionDepth Maximum number of levels to search, 0 to disable recursive lookup - * @return string storage PIDs + * @return array|int[] storage PIDs */ - abstract protected function getRecursiveStoragePids($storagePid, $recursionDepth = 0); + abstract protected function getRecursiveStoragePids(array $storagePids, int $recursionDepth = 0): array; } diff --git a/typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php b/typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php index cc07b2fb2f70f24d2ffe0c1b01284ae9b1aee4d9..4c78d9579e4dfa773f085bbccd4171f9b5e29ce2 100644 --- a/typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php +++ b/typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php @@ -1,4 +1,6 @@ <?php +declare(strict_types = 1); + namespace TYPO3\CMS\Extbase\Configuration; /* @@ -48,7 +50,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * * @return array the raw TypoScript setup */ - public function getTypoScriptSetup() + public function getTypoScriptSetup(): array { $pageId = $this->getCurrentPageId(); @@ -84,7 +86,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * @param string $pluginName in BE mode this is actually the module signature. But we're using it just like the plugin name in FE * @return array */ - protected function getPluginConfiguration($extensionName, $pluginName = null) + protected function getPluginConfiguration(string $extensionName, string $pluginName = null): array { $setup = $this->getTypoScriptSetup(); $pluginConfiguration = []; @@ -112,7 +114,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * @param string $pluginName in BE mode this is actually the module signature. But we're using it just like the plugin name in FE * @return array */ - protected function getSwitchableControllerActions($extensionName, $pluginName) + protected function getSwitchableControllerActions(string $extensionName, string $pluginName): array { $switchableControllerActions = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['modules'][$pluginName]['controllers'] ?? false; if (!is_array($switchableControllerActions)) { @@ -127,7 +129,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * * @return int current page id. If no page is selected current root page id is returned */ - protected function getCurrentPageId() + protected function getCurrentPageId(): int { if ($this->currentPageId !== null) { return $this->currentPageId; @@ -145,7 +147,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * * @return int the page UID, will be 0 if none has been set */ - protected function getCurrentPageIdFromGetPostData() + protected function getCurrentPageIdFromGetPostData(): int { return (int)GeneralUtility::_GP('id'); } @@ -155,7 +157,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * * @return int the page UID, will be 0 if none has been set */ - protected function getCurrentPageIdFromCurrentSiteRoot() + protected function getCurrentPageIdFromCurrentSiteRoot(): int { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable('pages'); @@ -188,7 +190,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * * @return int the page UID, will be 0 if none has been set */ - protected function getCurrentPageIdFromRootTemplate() + protected function getCurrentPageIdFromRootTemplate(): int { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable('sys_template'); @@ -219,10 +221,11 @@ class BackendConfigurationManager extends AbstractConfigurationManager /** * Returns the default backend storage pid * - * @return string + * @return int */ - public function getDefaultBackendStoragePid() + public function getDefaultBackendStoragePid(): int { + // todo: fallback to parent::getDefaultBackendStoragePid() would make sense here. return $this->getCurrentPageId(); } @@ -234,7 +237,7 @@ class BackendConfigurationManager extends AbstractConfigurationManager * @param array $frameworkConfiguration * @return array */ - protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration) + protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration): array { if (!isset($frameworkConfiguration['mvc']['requestHandlers'])) { $frameworkConfiguration['mvc']['requestHandlers'] = [ @@ -246,36 +249,37 @@ class BackendConfigurationManager extends AbstractConfigurationManager } /** - * Returns a comma separated list of storagePid that are below a certain storage pid. + * Returns an array of storagePIDs that are below a certain storage pid. * - * @param string $storagePid Storage PID to start at; multiple PIDs possible as comma-separated list + * @param array|int[] $storagePids Storage PIDs to start at; multiple PIDs possible as comma-separated list * @param int $recursionDepth Maximum number of levels to search, 0 to disable recursive lookup - * @return string storage PIDs + * @return array|int[] storage PIDs */ - protected function getRecursiveStoragePids($storagePid, $recursionDepth = 0) + protected function getRecursiveStoragePids(array $storagePids, $recursionDepth = 0): array { + array_map('intval', $storagePids); + if ($recursionDepth <= 0) { - return $storagePid; + return $storagePids; } - $recursiveStoragePids = ''; - $storagePids = GeneralUtility::intExplode(',', $storagePid); + $recursiveStoragePids = []; $permsClause = $this->getBackendUser()->getPagePermsClause(Permission::PAGE_SHOW); $queryGenerator = GeneralUtility::makeInstance(QueryGenerator::class); foreach ($storagePids as $startPid) { $pids = $queryGenerator->getTreeList($startPid, $recursionDepth, 0, $permsClause); - if ((string)$pids !== '') { - $recursiveStoragePids .= $pids . ','; + foreach (GeneralUtility::intExplode(',', $pids, true) as $pid) { + $recursiveStoragePids[] = $pid; } } - return rtrim($recursiveStoragePids, ','); + return array_unique($recursiveStoragePids); } /** * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */ - protected function getBackendUser() + protected function getBackendUser(): \TYPO3\CMS\Core\Authentication\BackendUserAuthentication { return $GLOBALS['BE_USER']; } diff --git a/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php b/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php index 4941e979304df74d401d11eebaae8b453845f825..bd267c852d33a21e7c484d32502fc9d9f126e6ea 100644 --- a/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php +++ b/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php @@ -1,4 +1,6 @@ <?php +declare(strict_types = 1); + namespace TYPO3\CMS\Extbase\Configuration; /* @@ -52,9 +54,7 @@ class ConfigurationManager implements \TYPO3\CMS\Extbase\Configuration\Configura $this->initializeConcreteConfigurationManager(); } - /** - */ - protected function initializeConcreteConfigurationManager() + protected function initializeConcreteConfigurationManager(): void { if ($this->environmentService->isEnvironmentInFrontendMode()) { $this->concreteConfigurationManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class); @@ -66,15 +66,15 @@ class ConfigurationManager implements \TYPO3\CMS\Extbase\Configuration\Configura /** * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */ - public function setContentObject(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject = null) + public function setContentObject(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject): void { $this->concreteConfigurationManager->setContentObject($contentObject); } /** - * @return \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer + * @return \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer|null */ - public function getContentObject() + public function getContentObject(): ?\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer { return $this->concreteConfigurationManager->getContentObject(); } @@ -85,7 +85,7 @@ class ConfigurationManager implements \TYPO3\CMS\Extbase\Configuration\Configura * * @param array $configuration The new configuration */ - public function setConfiguration(array $configuration = []) + public function setConfiguration(array $configuration = []): void { $this->concreteConfigurationManager->setConfiguration($configuration); } @@ -107,7 +107,7 @@ class ConfigurationManager implements \TYPO3\CMS\Extbase\Configuration\Configura * @throws Exception\InvalidConfigurationTypeException * @return array The configuration */ - public function getConfiguration($configurationType, $extensionName = null, $pluginName = null) + public function getConfiguration(string $configurationType, string $extensionName = null, string $pluginName = null): array { switch ($configurationType) { case self::CONFIGURATION_TYPE_SETTINGS: @@ -132,7 +132,7 @@ class ConfigurationManager implements \TYPO3\CMS\Extbase\Configuration\Configura * @param string $featureName * @return bool */ - public function isFeatureEnabled($featureName) + public function isFeatureEnabled(string $featureName): bool { $configuration = $this->getConfiguration(self::CONFIGURATION_TYPE_FRAMEWORK); return (bool)(isset($configuration['features'][$featureName]) && $configuration['features'][$featureName]); diff --git a/typo3/sysext/extbase/Classes/Configuration/ConfigurationManagerInterface.php b/typo3/sysext/extbase/Classes/Configuration/ConfigurationManagerInterface.php index 88a7702991edd78220ae11378a56ea54e728d76d..3e55b23ecd1911679551c0a265c27417c7fbbcaa 100644 --- a/typo3/sysext/extbase/Classes/Configuration/ConfigurationManagerInterface.php +++ b/typo3/sysext/extbase/Classes/Configuration/ConfigurationManagerInterface.php @@ -1,4 +1,6 @@ <?php +declare(strict_types = 1); + namespace TYPO3\CMS\Extbase\Configuration; /* @@ -27,14 +29,14 @@ interface ConfigurationManagerInterface extends \TYPO3\CMS\Core\SingletonInterfa /** * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */ - public function setContentObject(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject = null); + public function setContentObject(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject): void; /** * Get the content object * - * @return \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer + * @return \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer|null */ - public function getContentObject(); + public function getContentObject(): ?\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; /** * Returns the specified configuration. @@ -47,7 +49,7 @@ interface ConfigurationManagerInterface extends \TYPO3\CMS\Core\SingletonInterfa * @param string $pluginName if specified, the configuration for the given plugin will be returned. * @return array The configuration */ - public function getConfiguration($configurationType, $extensionName = null, $pluginName = null); + public function getConfiguration(string $configurationType, ?string $extensionName = null, ?string $pluginName = null): array; /** * Sets the specified raw configuration coming from the outside. @@ -55,7 +57,7 @@ interface ConfigurationManagerInterface extends \TYPO3\CMS\Core\SingletonInterfa * * @param array $configuration The new configuration */ - public function setConfiguration(array $configuration = []); + public function setConfiguration(array $configuration = []): void; /** * Returns TRUE if a certain feature, identified by $featureName @@ -67,5 +69,5 @@ interface ConfigurationManagerInterface extends \TYPO3\CMS\Core\SingletonInterfa * @param string $featureName * @return bool */ - public function isFeatureEnabled($featureName); + public function isFeatureEnabled(string $featureName): bool; } diff --git a/typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php b/typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php index 75442e964dfde73e23a25f48eec64f1b72a1f360..30776b61996b5a83bfc2df339307778083778e3a 100644 --- a/typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php +++ b/typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php @@ -1,4 +1,6 @@ <?php +declare(strict_types = 1); + namespace TYPO3\CMS\Extbase\Configuration; /* @@ -52,9 +54,9 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * * @return array the raw TypoScript setup */ - public function getTypoScriptSetup() + public function getTypoScriptSetup(): array { - return $GLOBALS['TSFE']->tmpl->setup; + return $GLOBALS['TSFE']->tmpl->setup ?? []; } /** @@ -65,7 +67,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @param string $pluginName * @return array */ - protected function getPluginConfiguration($extensionName, $pluginName = null) + protected function getPluginConfiguration(string $extensionName, string $pluginName = null): array { $setup = $this->getTypoScriptSetup(); $pluginConfiguration = []; @@ -95,7 +97,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @param string $pluginName * @return array */ - protected function getSwitchableControllerActions($extensionName, $pluginName) + protected function getSwitchableControllerActions(string $extensionName, string $pluginName): array { $switchableControllerActions = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['controllers']; if (!is_array($switchableControllerActions)) { @@ -112,7 +114,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @param array $frameworkConfiguration The framework configuration to modify * @return array the modified framework configuration */ - protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration) + protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration): array { $frameworkConfiguration = $this->overrideStoragePidIfStartingPointIsSet($frameworkConfiguration); $frameworkConfiguration = $this->overrideConfigurationFromPlugin($frameworkConfiguration); @@ -127,7 +129,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @param array $frameworkConfiguration the framework configurations * @return array the framework configuration with overridden storagePid */ - protected function overrideStoragePidIfStartingPointIsSet(array $frameworkConfiguration) + protected function overrideStoragePidIfStartingPointIsSet(array $frameworkConfiguration): array { $pages = $this->contentObject->data['pages']; if (is_string($pages) && $pages !== '') { @@ -159,7 +161,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @param array $frameworkConfiguration the framework configuration * @return array the framework configuration with overridden data from typoscript */ - protected function overrideConfigurationFromPlugin(array $frameworkConfiguration) + protected function overrideConfigurationFromPlugin(array $frameworkConfiguration): array { $setup = $this->getTypoScriptSetup(); $pluginSignature = strtolower($frameworkConfiguration['extensionName'] . '_' . $frameworkConfiguration['pluginName']); @@ -180,7 +182,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @param array $frameworkConfiguration the framework configuration * @return array the framework configuration with overridden data from flexForm */ - protected function overrideConfigurationFromFlexForm(array $frameworkConfiguration) + protected function overrideConfigurationFromFlexForm(array $frameworkConfiguration): array { $flexFormConfiguration = $this->contentObject->data['pi_flexform']; if (is_string($flexFormConfiguration)) { @@ -207,7 +209,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @param string $configurationPartName The name of the configuration part which should be merged. * @return array the processed framework configuration */ - protected function mergeConfigurationIntoFrameworkConfiguration(array $frameworkConfiguration, array $configuration, $configurationPartName) + protected function mergeConfigurationIntoFrameworkConfiguration(array $frameworkConfiguration, array $configuration, string $configurationPartName): array { if (isset($configuration[$configurationPartName]) && is_array($configuration[$configurationPartName])) { if (isset($frameworkConfiguration[$configurationPartName]) && is_array($frameworkConfiguration[$configurationPartName])) { @@ -227,7 +229,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst * @throws Exception\ParseErrorException * @return array the modified framework configuration, if needed */ - protected function overrideSwitchableControllerActionsFromFlexForm(array $frameworkConfiguration, array $flexFormConfiguration) + protected function overrideSwitchableControllerActionsFromFlexForm(array $frameworkConfiguration, array $flexFormConfiguration): array { if (!isset($flexFormConfiguration['switchableControllerActions']) || is_array($flexFormConfiguration['switchableControllerActions'])) { return $frameworkConfiguration; @@ -252,24 +254,25 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst /** * Returns a comma separated list of storagePid that are below a certain storage pid. * - * @param string $storagePid Storage PID to start at; multiple PIDs possible as comma-separated list + * @param array|int[] $storagePids Storage PIDs to start at; multiple PIDs possible as comma-separated list * @param int $recursionDepth Maximum number of levels to search, 0 to disable recursive lookup - * @return string storage PIDs + * @return array|int[] storage PIDs */ - protected function getRecursiveStoragePids($storagePid, $recursionDepth = 0) + protected function getRecursiveStoragePids(array $storagePids, int $recursionDepth = 0): array { + array_map('intval', $storagePids); + if ($recursionDepth <= 0) { - return $storagePid; + return $storagePids; } - $recursiveStoragePids = ''; - $storagePids = GeneralUtility::intExplode(',', $storagePid); + $recursiveStoragePids = []; foreach ($storagePids as $startPid) { $pids = $this->getContentObject()->getTreeList($startPid, $recursionDepth, 0); - if ((string)$pids !== '') { - $recursiveStoragePids .= $pids . ','; + foreach (GeneralUtility::intExplode(',', $pids, true) as $pid) { + $recursiveStoragePids[] = $pid; } } - return rtrim($recursiveStoragePids, ','); + return array_unique($recursiveStoragePids); } } diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php b/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php index e1a7deeb835ee841fb7b45f8e2b9067da0e70e9d..0a5eb890c7474c747c87f466640dc426f4b2771f 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php @@ -68,7 +68,7 @@ class QueryFactory implements QueryFactoryInterface, \TYPO3\CMS\Core\SingletonIn } $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); - $querySettings->setStoragePageIds(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid'])); + $querySettings->setStoragePageIds(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid'] ?? '')); $query->setQuerySettings($querySettings); return $query; } diff --git a/typo3/sysext/extbase/Tests/Unit/Configuration/AbstractConfigurationManagerTest.php b/typo3/sysext/extbase/Tests/Unit/Configuration/AbstractConfigurationManagerTest.php index 833ece29d470717766f5a0fe6fd63ce06ecb58df..5aacdeb10260f2b52c42b50023e2bfc436cbf683 100644 --- a/typo3/sysext/extbase/Tests/Unit/Configuration/AbstractConfigurationManagerTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Configuration/AbstractConfigurationManagerTest.php @@ -27,6 +27,8 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class AbstractConfigurationManagerTest extends UnitTestCase { + protected $resetSingletonInstances = true; + /** * @var AbstractConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|AccessibleObjectInterface */ @@ -243,9 +245,9 @@ class AbstractConfigurationManagerTest extends UnitTestCase 'persistence' => [ 'storagePid' => '123' ], - 'controllerConfiguration' => null + 'controllerConfiguration' => [] ]; - $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->with($expectedResult)->will($this->returnValue($expectedResult)); + $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->with($expectedResult)->willReturn($expectedResult); $actualResult = $this->abstractConfigurationManager->getConfiguration(); $this->assertEquals($expectedResult, $actualResult); } @@ -277,7 +279,7 @@ class AbstractConfigurationManagerTest extends UnitTestCase 'persistence' => [ 'storagePid' => '123' ], - 'controllerConfiguration' => null + 'controllerConfiguration' => [] ]; $this->abstractConfigurationManager->expects($this->never())->method('getContextSpecificFrameworkConfiguration'); $actualResult = $this->abstractConfigurationManager->getConfiguration('SomeExtensionName', 'SomePluginName'); @@ -367,7 +369,7 @@ class AbstractConfigurationManagerTest extends UnitTestCase ] ]; $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->will($this->returnValue($pluginConfiguration)); - $this->abstractConfigurationManager->expects($this->once())->method('getRecursiveStoragePids')->with('-1'); + $this->abstractConfigurationManager->expects($this->once())->method('getRecursiveStoragePids')->with([-1]); $this->abstractConfigurationManager->getConfiguration('SomeOtherExtensionName', 'SomeOtherCurrentPluginName'); } @@ -383,7 +385,7 @@ class AbstractConfigurationManagerTest extends UnitTestCase ] ]; $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->will($this->returnValue($pluginConfiguration)); - $this->abstractConfigurationManager->expects($this->once())->method('getRecursiveStoragePids')->with('-1,-25'); + $this->abstractConfigurationManager->expects($this->once())->method('getRecursiveStoragePids')->with([-1, -25]); $this->abstractConfigurationManager->getConfiguration('SomeOtherExtensionName', 'SomeOtherCurrentPluginName'); } diff --git a/typo3/sysext/extbase/Tests/Unit/Configuration/BackendConfigurationManagerTest.php b/typo3/sysext/extbase/Tests/Unit/Configuration/BackendConfigurationManagerTest.php index 00fcde28f73dd6bfab0c31e283a5e8e84b8980b6..8e29d2157b5f0fee60ed836ccc3a7e4b0c23bcd5 100644 --- a/typo3/sysext/extbase/Tests/Unit/Configuration/BackendConfigurationManagerTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Configuration/BackendConfigurationManagerTest.php @@ -23,6 +23,8 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class BackendConfigurationManagerTest extends UnitTestCase { + protected $resetSingletonInstances = true; + /** * @var \TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ @@ -306,7 +308,7 @@ class BackendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreExtendedIfRecursiveSearchIsConfigured() { - $storagePid = '1,2,3'; + $storagePids = [1, 2, 3]; $recursive = 99; /** @var \TYPO3\CMS\Core\Authentication\BackendUserAuthentication|ObjectProphecy $beUserAuthentication */ @@ -327,8 +329,8 @@ class BackendConfigurationManagerTest extends UnitTestCase ->will($this->onConsecutiveCalls('4', '', '5,6')); GeneralUtility::addInstance(QueryGenerator::class, $queryGenerator); - $expectedResult = '4,5,6'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive); + $expectedResult = [4, 5, 6]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids, $recursive); $this->assertEquals($expectedResult, $actualResult); } @@ -337,7 +339,7 @@ class BackendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreExtendedIfRecursiveSearchIsConfiguredAndWithPidIncludedForNegativePid() { - $storagePid = '1,2,-3'; + $storagePids = [1, 2, -3]; $recursive = 99; /** @var \TYPO3\CMS\Core\Authentication\BackendUserAuthentication|ObjectProphecy $beUserAuthentication */ @@ -358,8 +360,8 @@ class BackendConfigurationManagerTest extends UnitTestCase ->will($this->onConsecutiveCalls('4', '', '3,5,6')); GeneralUtility::addInstance(QueryGenerator::class, $queryGenerator); - $expectedResult = '4,3,5,6'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive); + $expectedResult = [4, 3, 5, 6]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids, $recursive); $this->assertEquals($expectedResult, $actualResult); } @@ -368,7 +370,7 @@ class BackendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreNotExtendedIfRecursiveSearchIsNotConfigured() { - $storagePid = '1,2,3'; + $storagePids = [1, 2, 3]; $abstractConfigurationManager = $this->getAccessibleMock( \TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::class, @@ -378,8 +380,8 @@ class BackendConfigurationManagerTest extends UnitTestCase false ); - $expectedResult = '1,2,3'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid); + $expectedResult = [1, 2, 3]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids); $this->assertEquals($expectedResult, $actualResult); } @@ -388,7 +390,7 @@ class BackendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreNotExtendedIfRecursiveSearchIsConfiguredForZeroLevels() { - $storagePid = '1,2,3'; + $storagePids = [1, 2, 3]; $recursive = 0; $abstractConfigurationManager = $this->getAccessibleMock( @@ -399,8 +401,8 @@ class BackendConfigurationManagerTest extends UnitTestCase false ); - $expectedResult = '1,2,3'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive); + $expectedResult = [1, 2, 3]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids, $recursive); $this->assertEquals($expectedResult, $actualResult); } } diff --git a/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php b/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php index 88be283b90cc963f008d15734b6a6111e42dc77f..cb8b1996fce1d922677455410ececb420cfb8f79 100644 --- a/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php @@ -29,6 +29,8 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class FrontendConfigurationManagerTest extends UnitTestCase { + protected $resetSingletonInstances = true; + /** * @var ContentObjectRenderer|\PHPUnit_Framework_MockObject_MockObject */ @@ -412,7 +414,7 @@ class FrontendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreExtendedIfRecursiveSearchIsConfigured(): void { - $storagePid = '3,5,9'; + $storagePids = [3, 5, 9]; $recursive = 99; /** @var $abstractConfigurationManager FrontendConfigurationManager */ $abstractConfigurationManager = $this->getAccessibleMock( @@ -435,8 +437,8 @@ class FrontendConfigurationManagerTest extends UnitTestCase ->will($this->onConsecutiveCalls('4', '', '898,12')); $abstractConfigurationManager->setContentObject($cObjectMock); - $expectedResult = '4,898,12'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive); + $expectedResult = [4, 898, 12]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids, $recursive); $this->assertEquals($expectedResult, $actualResult); } @@ -445,7 +447,7 @@ class FrontendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreExtendedIfRecursiveSearchIsConfiguredAndWithPidIncludedForNegativePid(): void { - $storagePid = '-3,5,9'; + $storagePids = [-3, 5, 9]; $recursive = 99; /** @var $abstractConfigurationManager FrontendConfigurationManager */ $abstractConfigurationManager = $this->getAccessibleMock( @@ -468,8 +470,8 @@ class FrontendConfigurationManagerTest extends UnitTestCase ->will($this->onConsecutiveCalls('3,4', '', '898,12')); $abstractConfigurationManager->setContentObject($cObjectMock); - $expectedResult = '3,4,898,12'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive); + $expectedResult = [3, 4, 898, 12]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids, $recursive); $this->assertEquals($expectedResult, $actualResult); } @@ -478,7 +480,7 @@ class FrontendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreNotExtendedIfRecursiveSearchIsNotConfigured(): void { - $storagePid = '1,2,3'; + $storagePids = [1, 2, 3]; /** @var $abstractConfigurationManager FrontendConfigurationManager */ $abstractConfigurationManager = $this->getAccessibleMock( @@ -499,8 +501,8 @@ class FrontendConfigurationManagerTest extends UnitTestCase $cObjectMock->expects($this->never())->method('getTreeList'); $abstractConfigurationManager->setContentObject($cObjectMock); - $expectedResult = '1,2,3'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid); + $expectedResult = [1, 2, 3]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids); $this->assertEquals($expectedResult, $actualResult); } @@ -509,7 +511,7 @@ class FrontendConfigurationManagerTest extends UnitTestCase */ public function storagePidsAreNotExtendedIfRecursiveSearchIsConfiguredForZeroLevels(): void { - $storagePid = '1,2,3'; + $storagePids = [1, 2, 3]; $recursive = 0; $abstractConfigurationManager = $this->getAccessibleMock( @@ -531,8 +533,8 @@ class FrontendConfigurationManagerTest extends UnitTestCase $cObjectMock->expects($this->never())->method('getTreeList'); $abstractConfigurationManager->setContentObject($cObjectMock); - $expectedResult = '1,2,3'; - $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive); + $expectedResult = [1, 2, 3]; + $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePids, $recursive); $this->assertEquals($expectedResult, $actualResult); } diff --git a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapperTest.php b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapperTest.php index aafd577ceac55ac2cd9cb25e0e49ae6964ebd7f5..ed2ceaa0f396e52bc4c002d9a7963a1fe270b06b 100644 --- a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapperTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapperTest.php @@ -29,6 +29,8 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class DataMapperTest extends UnitTestCase { + protected $resetSingletonInstances = true; + /** * This test does not actually test anything rather than map calls both mocked methods getTargetType and mapSingleRow * while completely ignoring the result of the method. diff --git a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php index 3d4fa824a02cea1d430e30a99c3ed0bbadb24f6c..c7dd4efe22d157c0dfbc148d7c371aa6151aa85b 100644 --- a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php @@ -21,6 +21,8 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class QueryTest extends UnitTestCase { + protected $resetSingletonInstances = true; + /** * @var \TYPO3\CMS\Extbase\Persistence\Generic\Query|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ diff --git a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/SessionTest.php b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/SessionTest.php index 1fa5881b5fef4e3b7292e205475d23ca70c4fa7e..f26ea5eed1926f8125749a2c0aeb0c5831dc3211 100644 --- a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/SessionTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/SessionTest.php @@ -22,6 +22,8 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class SessionTest extends UnitTestCase { + protected $resetSingletonInstances = true; + /** * @test */ diff --git a/typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php b/typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php index fbcfc7b3affccf652b598aad998d92e7358871c4..b8fb4b9734dfbc885376f7ddf0b21245dd33d907 100644 --- a/typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php @@ -247,7 +247,7 @@ class ExtensionServiceTest extends UnitTestCase */ public function getTargetPidByPluginSignatureReturnsNullIfConfigurationManagerIsNotInitialized() { - $this->mockConfigurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue(null)); + $this->mockConfigurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue([])); $this->assertNull($this->extensionService->getTargetPidByPlugin('ExtensionName', 'PluginName')); } diff --git a/typo3/sysext/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php b/typo3/sysext/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php index 9b3e7a91ae438cf2b94aa082638685dc5a1dc8e3..81ddf40871c20fa86a6fc008740b122c10039b82 100644 --- a/typo3/sysext/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php @@ -301,6 +301,10 @@ class LocalizationUtilityTest extends UnitTestCase */ public function translateTestWithBackendUserLanguage($key, $languageKey, $expected, array $altLanguageKeys = [], array $arguments = null) { + $this->configurationManagerInterfaceProphecy + ->getConfiguration('Framework', 'core', null) + ->willReturn([]); + $reflectionClass = new \ReflectionClass(LocalizationUtility::class); $property = $reflectionClass->getProperty('LOCAL_LANG'); @@ -328,6 +332,10 @@ class LocalizationUtilityTest extends UnitTestCase */ public function translateTestWithExplicitLanguageParameters($key, $languageKey, $expected, array $altLanguageKeys = [], array $arguments = null) { + $this->configurationManagerInterfaceProphecy + ->getConfiguration('Framework', 'core', null) + ->willReturn([]); + $reflectionClass = new \ReflectionClass(LocalizationUtility::class); $property = $reflectionClass->getProperty('LOCAL_LANG'); diff --git a/typo3/sysext/form/Classes/Mvc/Configuration/ConfigurationManager.php b/typo3/sysext/form/Classes/Mvc/Configuration/ConfigurationManager.php index 692749832bf32ecd2dda1a32111e97db5985587d..6b3cbb86729d9a5306b8ac7836ca9c310a2b43ff 100644 --- a/typo3/sysext/form/Classes/Mvc/Configuration/ConfigurationManager.php +++ b/typo3/sysext/form/Classes/Mvc/Configuration/ConfigurationManager.php @@ -57,7 +57,7 @@ class ConfigurationManager extends ExtbaseConfigurationManager implements Config * @return array The configuration * @internal */ - public function getConfiguration($configurationType, $extensionName = null, $pluginName = null) + public function getConfiguration(string $configurationType, string $extensionName = null, string $pluginName = null): array { switch ($configurationType) { case self::CONFIGURATION_TYPE_YAML_SETTINGS: diff --git a/typo3/sysext/form/Classes/Service/TranslationService.php b/typo3/sysext/form/Classes/Service/TranslationService.php index 50016fc25f7618ac8aa9ce24d52386ef2d7b37b4..80e7a06046014e9f0403fb38c038bee129d4fb0a 100644 --- a/typo3/sysext/form/Classes/Service/TranslationService.php +++ b/typo3/sysext/form/Classes/Service/TranslationService.php @@ -585,7 +585,7 @@ class TranslationService implements SingletonInterface $frameworkConfiguration = $this->getConfigurationManager() ->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'form'); - if (!is_array($frameworkConfiguration['_LOCAL_LANG'])) { + if (!is_array($frameworkConfiguration['_LOCAL_LANG'] ?? null)) { return; } $this->LOCAL_LANG_UNSET = []; diff --git a/typo3/sysext/form/Tests/Unit/Controller/FormFrontendControllerTest.php b/typo3/sysext/form/Tests/Unit/Controller/FormFrontendControllerTest.php index bbf0ff24bee47734dd0938dd77c76e77f7060c98..22608b003e6783501145d70f71a6566a8ca126bd 100644 --- a/typo3/sysext/form/Tests/Unit/Controller/FormFrontendControllerTest.php +++ b/typo3/sysext/form/Tests/Unit/Controller/FormFrontendControllerTest.php @@ -25,6 +25,7 @@ use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Form\Controller\FormFrontendController; use TYPO3\CMS\Form\Domain\Configuration\ConfigurationService; use TYPO3\CMS\Form\Mvc\Configuration\TypoScriptService; +use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** @@ -74,7 +75,7 @@ class FormFrontendControllerTest extends UnitTestCase ); $flexFormTools = new FlexFormTools; - $contentObject = new \stdClass(); + $contentObject = new ContentObjectRenderer(); $contentObject->data = [ 'pi_flexform' => $flexFormTools->flexArray2Xml([ 'data' => [ @@ -208,7 +209,7 @@ class FormFrontendControllerTest extends UnitTestCase ); $flexFormTools = new FlexFormTools; - $contentObject = new \stdClass(); + $contentObject = new ContentObjectRenderer(); $contentObject->data = [ 'pi_flexform' => $flexFormTools->flexArray2Xml([ 'data' => [ @@ -358,7 +359,7 @@ class FormFrontendControllerTest extends UnitTestCase ); $flexFormTools = new FlexFormTools; - $contentObject = new \stdClass(); + $contentObject = new ContentObjectRenderer(); $contentObject->data = [ 'pi_flexform' => $flexFormTools->flexArray2Xml([ 'data' => [