Project

General

Profile

Actions

Task #105648

open

POC for broken redirect handling to record link targets

Added by Torben Hansen about 20 hours ago. Updated about 20 hours ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-11-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Sprint Focus:

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.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #102892: RuntimeException when using redirects with record link targetsNewStefan Bürk2024-01-22

Actions
Actions #1

Updated by Torben Hansen about 20 hours ago

  • TYPO3 Version changed from 13 to 12
Actions #2

Updated by Torben Hansen about 20 hours ago

  • Related to Bug #102892: RuntimeException when using redirects with record link targets added
Actions

Also available in: Atom PDF