Project

General

Profile

Actions

Bug #87402

closed

Feature-79409 renderAssetsForRequest does not work for USER_INT/uncached

Added by Peter Niederlag over 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2019-01-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

<f:section name="HeaderAssets">
  <script>console.log('Section HeaderAssets was rendered');</script>
  <f:debug>I am always triggered however</f:debug>
</f:section>

Does NOT work for uncached Plugin on first hit/cold cache! the debug message is triggered but the script call is not inserted in the rendered html.
However it is working on subseqent calls.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Feature #79409: Render sections HeaderAssets and FooterAssets automatically from ActionController and attach to PageRendererClosed2017-01-22

Actions
Related to TYPO3 Core - Bug #89445: FooterAsset are not loadedClosedBenjamin Franzke2019-10-18

Actions
Related to TYPO3 Core - Bug #91316: MetaTagManagerRegistry instance not unique in uncached pluginsClosedBenjamin Franzke2020-05-06

Actions
Actions #1

Updated by Georg Ringer over 5 years ago

  • Related to Feature #79409: Render sections HeaderAssets and FooterAssets automatically from ActionController and attach to PageRenderer added
Actions #2

Updated by David Blatter almost 5 years ago

TYPO3\CMS\Extbase\Mvc\Controller\ActionController->renderAssetsForRequest fetches an instance of TYPO3\CMS\Core\Page\PageRenderer from TYPO3\CMS\Extbase\Object\ObjectManager. In ObjectManager these instances get cached. When rendering uncached elements, the singleton instance in GeneralUtility's cache gets replaced (TSFE->INTincScript calls GeneralUtility::setSingletonInstance). So chances are, that you get the "wrong" instance, when fetching a PageRenderer from ObjectManager.

Reproducible example:

There are two Content Elements on a page, element 1 is cached and element 2 is uncached. Both elements access the PageRenderer fetched from ObjectManager (which is always done for extbase Plugins in TYPO3\CMS\Extbase\Mvc\Controller\ActionController->renderAssetsForRequest).
  1. The PageRenderer instance gets cached inside ObjectManager when rendering Element 1.
  2. Before rendering Element 2, TSFE replaces the instance in INTincScript.
  3. When rendering Element 2, ObjectManager returns the original (not the replacement) instance.
    Therefore anything added to the PageRenderer in Element 2, e.g. through addHeaderData(), doesn't make it on the rendered page.
Solutions include:
  • One solution to this, would be to not cache PageRenderer instances inside ObjectManager (as in https://review.typo3.org/c/Packages/TYPO3.CMS/+/60943).
  • For this specific issue, it would also work to make ActionController->renderAssetsForRequest fetch the PageRenderer directly form core's GeneralUtility instead of extbase's ObjectManager. But there might be other uses of PageGenerator in extbase plugins that would still be affected.
  • One could also ask, what the purpose of caching SingletonInterface instances in extbase's ObjectManager is? Since those get cached by GeneralUtility too. It would maybe be cleaner to delegate the caching of instances implementing SingletonInterface completely to GeneralUtility.
  • As Alexander Schnitzler mentioned, removing the usage of GeneralUtility::setSingletonInstance in TSFE would also work, but to me that seems to be the most intrusive solution. I have no clue what it's there for.
Actions #3

Updated by Gerrit Code Review almost 5 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60943

Actions #4

Updated by Daniel Goerz over 4 years ago

  • Related to Bug #89445: FooterAsset are not loaded added
Actions #5

Updated by Daniel Goerz over 4 years ago

  • Status changed from Under Review to Resolved

The issue was fixed with #89445

Actions #6

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions #7

Updated by Georg Ringer almost 4 years ago

  • Related to Bug #91316: MetaTagManagerRegistry instance not unique in uncached plugins added
Actions

Also available in: Atom PDF