Breaking: #97862 - Hooks related to generating page content removed 

See forge#97862

Description 

The existing TYPO3 hooks in the process of generating a TYPO3 Frontend page

  • $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-cached']
  • $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']
  • $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['usePageCache']
  • $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['insertPageIncache']

have been removed. These hooks have been used to execute custom PHP code after a page is generated in the TYPO3 frontend and ready to be stored in cache.

Due to the removal of the hooks and the introduction of the new PSR-14 events the method signature of TypoScriptFrontendController->generatePage_postProcessing() has been changed. The method now requires a ServerRequestInterface as first argument.

Impact 

Extension code that hooks into these places will not be executed anymore in TYPO3 v12+.

Extension code calling TypoScriptFrontendController->generatePage_postProcessing() without providing a ServerRequestInterface as first argument will trigger a PHP ArgumentCountError.

Affected installations 

TYPO3 installations with custom extensions using these hooks such as static file generation or modifying the page content cache, which is highly likely in third-party extensions. The extension scanner will detect usages as strong match.

Extensions, manually calling TypoScriptFrontendController->generatePage_postProcessing() without providing a ServerRequestInterface as first argument. The extension scanner will detect usages as weak match.

Migration 

Use one of the two newly introduced PSR-14 events:

  • \TYPO3\CMS\Frontend\Event\AfterCacheableContentIsGeneratedEvent
  • \TYPO3\CMS\Frontend\Event\AfterCachedPageIsPersistedEvent

Extensions using the hooks can be made compatible with TYPO3 v11 and TYPO3 v12 by registering a PSR-14-based event listener while keeping the legacy hook in place.

The AfterCacheableContentIsGeneratedEvent acts as a replacement for

  • $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-cached']
  • $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']
  • $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['usePageCache']

whereas the AfterCachedPageIsPersistedEvent is the replacement for

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['insertPageIncache'] .

Provide a ServerRequestInterface as first argument when calling TypoScriptFrontendController->generatePage_postProcessing() in custom extension code.