Skip to content

Commit

Permalink
[BUGFIX] Normalize storage PID on TYPO3v12
Browse files Browse the repository at this point in the history
The new TypoScript parser introduced in TYPO3v12 yields a regular integer in case of a single storagePid. Only in case of a CSV this will be a string. This in turn leads to explode() failing with a type error in the integer case.

Fix this by normalizing the setting value to string.

Fixes: TYPO3GmbH#301
  • Loading branch information
mbrodala committed Jul 16, 2024
1 parent ce2dc48 commit 718fe15
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/CategoryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function initializeObject(): void
GeneralUtility::makeInstance(Context::class),
$configurationManager
);
$querySettings->setStoragePageIds(GeneralUtility::intExplode(',', $this->settings['persistence']['storagePid']));
$querySettings->setStoragePageIds(GeneralUtility::intExplode(',', (string)$this->settings['persistence']['storagePid']));
$this->setDefaultQuerySettings($querySettings);

$this->defaultOrderings = [
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/PostRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function findRelatedPosts(int $categoryMultiplier = 1, int $tagMultiplier

protected function getStoragePidsFromTypoScript(): array
{
return GeneralUtility::intExplode(',', $this->settings['persistence']['storagePid']);
return GeneralUtility::intExplode(',', (string)$this->settings['persistence']['storagePid']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/TagRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function findTopByUsage(int $limit = 20): array
// limitation to storage pid for multi domain purpose
if ($this->settings['persistence']['storagePid']) {
// force storage pids as integer
$storagePids = GeneralUtility::intExplode(',', $this->settings['persistence']['storagePid']);
$storagePids = GeneralUtility::intExplode(',', (string)$this->settings['persistence']['storagePid']);
$queryBuilder->where('t.pid IN(' . implode(',', $storagePids) . ')');
}

Expand Down

0 comments on commit 718fe15

Please sign in to comment.