Issue Feature Rejected

#19163Automatically execute nested USER_INT/COA_INT objects as regular USER/COA objects

Oliver Hader 07/28/08, 15:35 updated 11/13/26, 17:32

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

  1. Andreas commented <span data-processor="relativetime" data-value="2008-07-28T15:39:13+00:00" > 07/28/08, 15:39 </span>

    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
    }
    }
    }

  2. 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…

  3. 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_pi1

    Here we go… and there are more variants how this easily could happen…

  4. Alexander Opitz commented and changed category status Accepted Needs 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?

  5. 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.

  6. Benni Mack commented and changed status On Hold Needs 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?

  7. Benni Mack commented and changed status Needs Feedback Rejected <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.

  8. Gerrit Code Review pushed patch set 1 for main to change 77841 status Accepted Under Review <span data-processor="relativetime" data-value="2023-02-13T11:58:57+00:00" > 02/13/23, 11:58 </span>

  9. Benni Mack commented and changed status Under Review Rejected <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 registry

    For 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.