#19163Automatically execute nested USER_INT/COA_INT objects as regular USER/COA objects
Description
Imagine you have the following situation in TypoScript:
10 = COA_INT
10 {
10 = COA_INT
10 {
10 = COA_INT
10 {
10 = TEXT
10.value = Test
}
}
}
The nestification of the COA_INT objects would result in recursing calls for each new level of that *_INT object. However, for the first occurence of COA_INT the caching for that object and nested objects is already disabled – thus it’s not required to perform this task again.
(issue imported from #M9065)
Reviews 1
Files 1
History 1820
-
Oliver Hader commented <span data-processor="relativetime" data-value="2008-07-28T15:45:36+00:00" > 07/28/08, 15:45 </span>
Ooooh yeah! Absolutely right, it should not. But it defintively happens! So, any more constructive feedback?!
And by the way… the attached patch is exactly doing what you did manually… -
Oliver Hader commented <span data-processor="relativetime" data-value="2008-07-28T15:54:16+00:00" > 07/28/08, 15:54 </span>
To justify this issue, imagine you get an extension from TER that sets up the following TypoScript:
plugin.tx_myext_pi1 = USER_INT
plugin.tx_myext_pi1 {
…
}And then you’d just put it somewhere to your page, inside a COA_INT like this:
page = PAGE
page.10 = COA_INT
page.10.10 =< plugin.tx_myext_pi1Here we go… and there are more variants how this easily could happen…
-
Andreas commented <span data-processor="relativetime" data-value="2008-07-28T16:53:00+00:00" > 07/28/08, 16:53 </span>
Ok, now i’ve got it :)
-
Alexander Opitz commented and changed category status
AcceptedNeeds Feedback target version <span data-processor="relativetime" data-value="2013-05-07T16:14:28+00:00" > 05/07/13, 16:14 </span>As this report is very old, is the handling in newer TYPO3 CMS Versions (like 6.0/6.1) more like you expect it?
-
Oliver Hader commented <span data-processor="relativetime" data-value="2013-05-07T20:08:38+00:00" > 05/07/13, 20:08 </span>
The handling is still the same in TYPO3 CMS 6.x.
-
Oliver Hader changed status
Needs FeedbackOn Hold <span data-processor="relativetime" data-value="2013-05-07T20:08:47+00:00" > 05/07/13, 20:08 </span> -
Mathias Schreiber changed target version <span data-processor="relativetime" data-value="2015-01-16T17:18:44+00:00" > 01/16/15, 17:18 </span>
-
Benni Mack changed target version <span data-processor="relativetime" data-value="2015-06-15T18:11:59+00:00" > 06/15/15, 18:11 </span>
-
Susanne Moog changed target version <span data-processor="relativetime" data-value="2015-08-05T10:45:55+00:00" > 08/05/15, 10:45 </span>
-
Benni Mack changed target version <span data-processor="relativetime" data-value="2015-09-24T11:17:00+00:00" > 09/24/15, 11:17 </span>
-
Riccardo De Contardi changed target version <span data-processor="relativetime" data-value="2017-02-23T14:55:21+00:00" > 02/23/17, 14:55 </span>
-
Benni Mack commented and changed status
On HoldNeeds Feedback <span data-processor="relativetime" data-value="2017-10-26T10:51:14+00:00" > 10/26/17, 10:51 </span>So how about pushing your idea to gerrit and add tests to that?
-
Susanne Moog changed category <span data-processor="relativetime" data-value="2017-10-29T16:31:13+00:00" > 10/29/17, 16:31 </span>
-
Susanne Moog changed target version <span data-processor="relativetime" data-value="2018-01-28T17:44:49+00:00" > 01/28/18, 17:44 </span>
-
Benni Mack commented and changed status
Needs FeedbackRejected <span data-processor="relativetime" data-value="2020-05-12T21:34:43+00:00" > 05/12/20, 21:34 </span>Won’t do. This is a nice to have one, but definitively makes the complexity higher. Instead, let’s treat each USER/COA as a cached response and use that one instead.
-
Benni Mack changed status
RejectedAccepted <span data-processor="relativetime" data-value="2020-05-12T21:35:25+00:00" > 05/12/20, 21:35 </span> -
Gerrit Code Review pushed patch set 1 for main to change 77841 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2023-02-13T11:58:57+00:00" > 02/13/23, 11:58 </span> -
Gerrit Code Review pushed patch set 2 for main to change 77841 <span data-processor="relativetime" data-value="2023-02-15T07:46:04+00:00" > 02/15/23, 07:46 </span>
-
Benni Mack commented and changed status
Under ReviewRejected <span data-processor="relativetime" data-value="2026-11-13T17:32:31+00:00" > 11/13/26, 17:32 </span>Current behaviour (v14 / main)
COA_INT and USER_INT always register a non-cached placeholder () and return it in place of content. That stays true when they are already being rendered inside a non-cached context. RequestHandler::recursivelyReplaceIntPlaceholdersInContent() resolves placeholders in a loop until no new ones appear. So nested *_INT objects render correctly; each extra nesting level just costs one more pass.
Actual cost of a nested level
One extra pass does the following:
- splits and reassembles the full page HTML by <!—INT_SCRIPT., which is linear in page size
- runs NonceValueSubstitution (CSP nonce replacement) again on the full page, if the page uses a nonce
- serializes and unserializes the renderer state (essentially the current record) and creates a fresh ContentObjectRenderer
- does an array_diff_assoc() on the placeholder registryFor a typical 100–300 KB page this is roughly 0.05–0.3 ms per extra nesting level. The work done inside the plugin itself (queries, Extbase, Fluid) happens exactly once in both cases. A request with *_INT content already costs at least 10–30 ms (bootstrap and middleware stack), plus whatever the plugin does. The possible saving is therefore below 1% of the request, even for setups nested several levels deep. The number of passes depends on the nesting depth, not on the number of *_INT objects: one pass resolves every placeholder on the same level.
Why the proposed patch (https://review.typo3.org/c/Packages/TYPO3.CMS/+/77841) is not the way to go
The patch walks the COA_INT configuration and rewrites every value equal to USER_INT or COA_INT into USER or COA. That has three problems:
- It misses the scenario described in this issue. page.10.10 =< plugin.tx_myext_pi1 leaves a reference in the configuration that is only resolved at render time. Plugins rendered via CONTENT or RECORDS (tt_content) never show up in that configuration at all.
- It rewrites property values blindly. For example, 10.value = COA_INT would turn into COA.
- It changes the object type that extensions see. A USER_INT rendered as USER reports ContentObjectRenderer::OBJECTTYPE_USER. Extbase uses that type to decide whether a non-cacheable action has to call convertToUserIntObject(), so it would create a new placeholder anyway. EXT:form uses it to decide whether a form is rendered cached. Behaviour would change while nothing gets faster.Alternative approach, if this is ever needed
Do it at runtime, not by rewriting configuration:
1. When RequestHandler creates the ContentObjectRenderer for a non-cached part, it marks that renderer as rendering in a non-cached context.
2. CONTENT, RECORDS and the other child renderers inherit the marker.
3. In that context, COA_INT renders its content directly as a COA. USER_INT calls its user function directly and keeps reporting OBJECTTYPE_USER_INT, so Extbase, EXT:form and third-party code see no difference.
4. Functional tests would cover: the number of placeholder passes for nested COA_INT/USER_INT (directly, via =< references, and via tt_content), Extbase non-cacheable actions inside a COA_INT, and CSP nonce substitution.This is a contained change, but given the measured benefit it is not worth the added complexity right now. A more promising direction for performance is the one mentioned earlier in this issue: caching individual USER/COA results so a page can be assembled from cached fragments, rather than tuning the non-cached path.
The idea behind this issue is not lost. If someone has a real-world setup where the nested passes are measurable (very large pages or deep nesting), please open a new issue with numbers and reference this one.
this is bad typoscript programming. nobody should programming like this.
correct way:
10 = COA_INT
10 {
10 = COA
10 {
10 = COA
10 {
10 = TEXT
10.value = Test
}
}
}