Task #105648
openPOC for broken redirect handling to record link targets
0%
Description
This issue is related to #102892 and documents, how to easily reproduce the described problem by providing required configuration setup.
Affected TYPO3 Versions: 12.4 and 13.4
1 . Add the following Page TSConfig
TCEMAIN { linkHandler { tx_pages_test { handler = TYPO3\CMS\Backend\LinkHandler\RecordLinkHandler label = Test Page Record Link configuration { table = pages storagePid = 1 hidePageTree = 0 } scanAfter = page } } }
2. Add TypoScript configuration for record links
config.recordLinks { tx_pages_test { typolink { parameter.data = field:uid useCacheHash = 1 } forceLink = 1 } }
3. Clear all caches
4. Open redirects module and create a new redirect for the source path /test-page-redirect
and configure as target path a record link to a page (e.g. t3://record?identifier=tx_pages_test&uid=1
). Finally save the redirect record.
Problem 1:
After closing the record in the redirects module, it is not possible to open the redirects module any more, since the Fluid view tries to resolve the configured redirect using DatabaseRecordLinkBuilder
, which relies on frontend.page.information
request attribute.
The following exception is thrown in typo3/sysext/frontend/Classes/Typolink/DatabaseRecordLinkBuilder.php line 122
:
Call to a member function getId() on null
Problem 2:
Clear all caches and make sure to open a regular page in TYPO3 frontend, so global TypoScript is at least loaded and cached once. Next, open the redirect https://domain.tld/test-page-redirect
. This will result in the following exception:
Setup array has not been initialized. This happens in cached Frontend scope where full TypoScript is not needed by the system.
Also here, the DatabaseRecordLinkBuilder
is reason for the exception, since it is tried to access $request->getAttribute('frontend.typoscript')?->getSetupArray()
, which is empty at this state in the PSR-14 MiddleWare of the redirects extension.
Updated by Torben Hansen about 20 hours ago
- Related to Bug #102892: RuntimeException when using redirects with record link targets added