Commit 61af3e74 authored by Chris Müller's avatar Chris Müller Committed by Benni Mack
Browse files

[BUGFIX] Avoid undefined array key warnings in DatabaseRecordLinkBuilder

Resolves: #96420
Releases: main, 11.5
Change-Id: Ida1b27956bfe759062904ee9d0c8246ea73f0667
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72763
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72778


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 308e07f1
......@@ -34,8 +34,8 @@ class DatabaseRecordLinkBuilder extends AbstractTypolinkBuilder
$tsfe = $this->getTypoScriptFrontendController();
$pageTsConfig = $tsfe->getPagesTSconfig();
$configurationKey = $linkDetails['identifier'] . '.';
$configuration = $tsfe->tmpl->setup['config.']['recordLinks.'];
$linkHandlerConfiguration = $pageTsConfig['TCEMAIN.']['linkHandler.'];
$configuration = $tsfe->tmpl->setup['config.']['recordLinks.'] ?? [];
$linkHandlerConfiguration = $pageTsConfig['TCEMAIN.']['linkHandler.'] ?? [];
if (!isset($configuration[$configurationKey], $linkHandlerConfiguration[$configurationKey])) {
throw new UnableToLinkException(
......@@ -48,7 +48,7 @@ class DatabaseRecordLinkBuilder extends AbstractTypolinkBuilder
$typoScriptConfiguration = $configuration[$configurationKey]['typolink.'];
$linkHandlerConfiguration = $linkHandlerConfiguration[$configurationKey]['configuration.'];
if ($configuration[$configurationKey]['forceLink']) {
if ($configuration[$configurationKey]['forceLink'] ?? false) {
$record = $tsfe->sys_page->getRawRecord($linkHandlerConfiguration['table'], $linkDetails['uid']);
} else {
$record = $tsfe->sys_page->checkRecord($linkHandlerConfiguration['table'], $linkDetails['uid']);
......@@ -67,9 +67,9 @@ class DatabaseRecordLinkBuilder extends AbstractTypolinkBuilder
unset($conf['parameter.']);
$typoLinkCodecService = GeneralUtility::makeInstance(TypoLinkCodecService::class);
$parameterFromDb = $typoLinkCodecService->decode($conf['parameter']);
$parameterFromDb = $typoLinkCodecService->decode($conf['parameter'] ?? '');
unset($parameterFromDb['url']);
$parameterFromTypoScript = $typoLinkCodecService->decode($typoScriptConfiguration['parameter']);
$parameterFromTypoScript = $typoLinkCodecService->decode($typoScriptConfiguration['parameter'] ?? '');
$parameter = array_replace_recursive($parameterFromTypoScript, array_filter($parameterFromDb));
$typoScriptConfiguration['parameter'] = $typoLinkCodecService->encode($parameter);
......
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