Bug #86492
closedstdWrap on config.additionalHeaders is broken for (fully) cached pages.
100%
Description
The feature to use stdWrap for additionalHeaders was introduced in v9 development cycle: https://review.typo3.org/c/50142/
It seems this is broken since the initial commit (and is still in master).
Suppose using the following TypoScript (as suggested in the documentation):
config.additionalHeaders { 10 { # The header string header = X-TYPO3-foo: header.dataWrap = |{page:uid} } }
Both the original commit 2124bba49f68f5c35705c5c499abe6a0ee95a6cf and current master result in an Exception for a page that is read from cache because TypoScriptFrontendController->cObj
is not initialized:
? $this->cObj->stdWrap(trim($header), $options['header.']) Oops, an error occurred! Call to a member function stdWrap() on string.
cObj is initialized in TSFE::newCObj, which is called by TSFE::preparePageContentGeneration
, which itself is only called if the page is uncached or rendered initially (for good reasons).
I'm not sure whether we should revert this feature, instead of fixing this and implcitly allowing uncached stuff to be executed (through stdWrap) for a fully cached page. Things like these may be better handled by middlewares.