Commit 5d4e86cd authored by Oliver Klee's avatar Oliver Klee Committed by Stefan Bürk
Browse files

[BUGFIX] Always call GU::intExplode with a string in EXT:extbase

This helps avoid breakage when GeneralUtility will switch to
strict mode.

This change also prevents a whole bunch of possible invalid
array access warnings.

Resolves: #97583
Relates: #97578
Releases: main
Change-Id: Id500872d91a7b47c647bb9a4d860477ee9ca7595
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74961

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent b5c1adc8
......@@ -176,7 +176,7 @@ abstract class AbstractConfigurationManager implements SingletonInterface
if (!empty($frameworkConfiguration['persistence']['recursive'])) {
$storagePids = $this->getRecursiveStoragePids(
GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']),
GeneralUtility::intExplode(',', (string)($frameworkConfiguration['persistence']['storagePid'] ?? '')),
(int)$frameworkConfiguration['persistence']['recursive']
);
$frameworkConfiguration['persistence']['storagePid'] = implode(',', $storagePids);
......
......@@ -121,8 +121,8 @@ class FrontendConfigurationManager extends AbstractConfigurationManager
*/
protected function overrideStoragePidIfStartingPointIsSet(array $frameworkConfiguration): array
{
$pages = $this->contentObject->data['pages'] ?? '';
if (is_string($pages) && $pages !== '') {
$pages = (string)($this->contentObject->data['pages'] ?? '');
if ($pages !== '') {
$storagePids = GeneralUtility::intExplode(',', $pages, true);
$recursionDepth = (int)($this->contentObject->data['recursive'] ?? 0);
$recursiveStoragePids = $this->pageRepository->getPageIdsRecursive($storagePids, $recursionDepth);
......
......@@ -936,7 +936,7 @@ class Backend implements BackendInterface, SingletonInterface
return (int)$frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'];
}
}
$storagePidList = GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']);
$storagePidList = GeneralUtility::intExplode(',', (string)($frameworkConfiguration['persistence']['storagePid'] ?? ''));
return (int)$storagePidList[0];
}
......
......@@ -484,7 +484,8 @@ class DataMapper
);
}
} else {
$constraint = $query->in('uid', GeneralUtility::intExplode(',', $fieldValue));
// Note: $fieldValue is annotated as a string, but this cannot be trusted as the callers do not ensure this.
$constraint = $query->in('uid', GeneralUtility::intExplode(',', (string)$fieldValue));
}
if (!empty($relationTableMatchFields)) {
foreach ($relationTableMatchFields as $relationTableMatchFieldName => $relationTableMatchFieldValue) {
......
......@@ -61,7 +61,7 @@ class QueryFactory implements QueryFactoryInterface, SingletonInterface
}
$frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$querySettings->setStoragePageIds(GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid'] ?? ''));
$querySettings->setStoragePageIds(GeneralUtility::intExplode(',', (string)($frameworkConfiguration['persistence']['storagePid'] ?? '')));
$query->setQuerySettings($querySettings);
return $query;
}
......
Markdown is supported
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