Project

General

Profile

Actions

Bug #102892

open

RuntimeException when using redirects with record link targets

Added by Christian Gebing 3 months ago. Updated about 1 month ago.

Status:
New
Priority:
Should have
Assignee:
Category:
Redirect Handling
Target version:
-
Start date:
2024-01-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I get the following exception for redirects with record links targets after the site is stored in the cache:

(1/1) #1666513645 RuntimeException

Setup array has not been initialized. This happens in cached Frontend scope where full TypoScript is not needed by the system.
Steps to reproduce:
  1. Flush caches via the maintanance tool
  2. Add a new redirect with a record link target (e.g. t3://record?identifier=example&uid=1)
  3. Follow the redirect
  4. Open the start page or any other page on the current site
  5. Attempt to follow the redirect again

Tested on a minimal TYPO3 ddev setup: https://github.com/cgebing/typo3_record_link_test


Files

2024-01-22_18-57.png (66.3 KB) 2024-01-22_18-57.png Redirect Christian Gebing, 2024-01-22 17:58
Actions #1

Updated by Stefan Bürk 3 months ago

  • Assignee set to Stefan Bürk
Actions #2

Updated by Armin Vieweg about 2 months ago

I can reconstruct this issue.
It disappears, when clearing the frontend cache, then the redirects work as expected.

But as soon as I call the front page (the first page in rootLine, which contains the TypoScript setup) and this page gets cached, the redirect break, with the exception from above.

I tried several TYPO3 versions. This issue seems to occure since 12.4.2. In 12.4.1 I am not able to reconstruct the issue, by calling the first page in rootLine (the front page). There, the redirections always work.

Actions #3

Updated by Armin Vieweg about 2 months ago

A quick fix is, to disable caching on the first page in rootLine, with e.g.

# Quick fix for https://forge.typo3.org/issues/102892
[traverse(page, "uid") == 1]
config.no_cache = 1
[end]

Absolutely not ideal or recommended, but this solves the issue, which only occures when the first page is being cached.

Actions #4

Updated by Armin Vieweg about 2 months ago

I also found the commit, which causes the issue:
https://git.typo3.org/typo3/typo3/-/commit/bd4980f237bf844939b959d0a83909aa7a44b0e0

The issue only occures when the feature toggle "Security: frontend enforce content security policy" [security.frontend.enforceContentSecurityPolicy] is disabled.

Actions #5

Updated by Oliver Hader about 2 months ago

I don't think this is related to CSP, but more related to cached TypoScript (I might look into this during the next few days/weeks):
https://github.com/TYPO3/typo3/blob/a085e88596eacb3f2e12bdd49d2f3e7a47faed2c/typo3/sysext/core/Classes/TypoScript/FrontendTypoScript.php#L132-L138

Actions #6

Updated by Benni Mack about 2 months ago

Some more notes:

This is related to a fully cached page not having TypoScript anymore, see another issue / bugfix which happened in adminpanel on a fully cached page:

https://review.typo3.org/c/Packages/TYPO3.CMS/+/82396

Actions #7

Updated by Armin Vieweg about 1 month ago

@Oliver Hader So, when CSP is on the page cache does not work anymore? Sounds a little bit like that.

@Benni Mack Caching and providing the rendered Typoscript configuration, could solve this, maybe?

Or the redirect Middleware must get enabled to parse the Typoscript, when being triggered and when the target starts with "t3:".

But maybe there are other edge cases, like redirects, which require the parsed Typoscript config.

Actions

Also available in: Atom PDF