Skip to content

Commit

Permalink
[BUGFIX] Always call GU::trimExplode with string in extbase/fluid
Browse files Browse the repository at this point in the history
This avoids problem when GU::trimExplode is switched to native type
declarations.

Also fix some possible invalid array accesses.

Resolves: #97960
Relates: #97602
Releases: main
Change-Id: I6a08b7a20f12475fbee7a5a817f1618e9466087c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75210
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
oliverklee authored and lolli42 committed Jul 27, 2022
1 parent af3f188 commit 03f0b01
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
Expand Up @@ -63,7 +63,7 @@ public function process(ContainerBuilder $container): void
);
}

$sources = GeneralUtility::trimExplode(',', $attributes['sources'], true);
$sources = GeneralUtility::trimExplode(',', (string)$attributes['sources'], true);

if ($sources === []) {
throw new InvalidTypeConverterConfigurationException(
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/extbase/Classes/Service/CacheService.php
Expand Up @@ -173,7 +173,7 @@ protected function clearPageCacheForGivenRecord(string $tableName, int $uid): vo

$pageTS = BackendUtility::getPagesTSconfig($storagePage);
if (isset($pageTS['TCEMAIN.']['clearCacheCmd'])) {
$clearCacheCommands = GeneralUtility::trimExplode(',', strtolower($pageTS['TCEMAIN.']['clearCacheCmd']), true);
$clearCacheCommands = GeneralUtility::trimExplode(',', strtolower((string)$pageTS['TCEMAIN.']['clearCacheCmd']), true);
$clearCacheCommands = array_unique($clearCacheCommands);
foreach ($clearCacheCommands as $clearCacheCommand) {
if (MathUtility::canBeInterpretedAsInteger($clearCacheCommand)) {
Expand Down
10 changes: 4 additions & 6 deletions typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
Expand Up @@ -61,14 +61,12 @@ public static function configurePlugin($extensionName, $pluginName, array $contr
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['controllers'][$controllerClassName] = [
'className' => $controllerClassName,
'alias' => $controllerAlias,
'actions' => GeneralUtility::trimExplode(',', $actionsList),
'actions' => GeneralUtility::trimExplode(',', (string)$actionsList),
];

if (isset($nonCacheableControllerActions[$controllerClassName]) && !empty($nonCacheableControllerActions[$controllerClassName])) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['controllers'][$controllerClassName]['nonCacheableActions'] = GeneralUtility::trimExplode(
',',
$nonCacheableControllerActions[$controllerClassName]
);
if (!empty($nonCacheableControllerActions[$controllerClassName])) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['controllers'][$controllerClassName]['nonCacheableActions']
= GeneralUtility::trimExplode(',', (string)$nonCacheableControllerActions[$controllerClassName]);
}
}

Expand Down
Expand Up @@ -121,7 +121,7 @@ public function initializeArguments(): void
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
{
$data = $renderChildrenClosure();
$typoscriptObjectPath = $arguments['typoscriptObjectPath'];
$typoscriptObjectPath = (string)$arguments['typoscriptObjectPath'];
$currentValueKey = $arguments['currentValueKey'];
$table = $arguments['table'];
$contentObjectRenderer = self::getContentObjectRenderer($renderingContext->getRequest());
Expand Down
Expand Up @@ -91,7 +91,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
} else {
$units = LocalizationUtility::translate('viewhelper.format.bytes.units', 'fluid');
}
$units = GeneralUtility::trimExplode(',', $units, true);
$units = GeneralUtility::trimExplode(',', (string)$units, true);

$value = $renderChildrenClosure();

Expand Down

0 comments on commit 03f0b01

Please sign in to comment.