Fluid caches default view paths
The issue can be reproduced as follows:
1) configure (and optionally register) a normal Extbase plugin to call a controller action
2) define this plugin as USER function (normal TS to render Extbase) on the PAGE TS object (any typeNum)
3) define multiple view paths for the extension containing the plugin
4) Install Flux and register a template as CType
Fluid is asked to return view paths for a the extension name at two different execution points - first, during bootstrapping (before TS is available) and then again after bootstrapping is done (when TS is available). Because Fluid uses the runtime cache to store retrieved template paths, the first fallbacks-only set of paths is cached and returned for the second request after TS is available.
End result is that Fluid ignores the TS paths.
Although this currently requires Flux to expose, the bug is not in Flux itself and cannot be properly prevented there. It is also possible to reproduce this problem by subscribing to a hook in TSFE which gets called before TS is parsed, and have this hook subscriber render a template from an extension which also contains a plugin that will be rendered as page content or via USER TS object. The first rendering will then cause the paths to be cached and subsequent renderings will not detect any TS path settings.
The problem can be fixed by not allowing CMS Fluid's TemplatePaths to be stored in runtime cache when the paths are purely fallbacks. By caching only when the "configured paths" (read: specified using setters or defined in TS) we circumvent the problem.
Updated by Riccardo De Contardi over 1 year ago
- Status changed from Needs Feedback to New
Asked Claus - still present.
1- It's still relevant for people who have trouble with default template paths being cached
2- There are a handful of other issues that relate to it (trouble with template paths and context)
3- When we finally switch to Fluid 3.0 the template paths and view become deprecated, at which time TYPO3 is likely to adopt a different API than "TemplatePaths" class (and when it does I will be watchful and not allow it to cache path settings because the rest of Fluid isn't cached anymore)