Review main Merged

78650[BUGFIX] Extbase BackendConfigurationManager fakes sys_template

Christian Kuhn CR +2 V +2 Normal +30 −21 updated 04/17/23, 13:57

Commit message

The TypoScript parser has to load TypoScript from globals
($GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_')
and TypoScript from extension static files
(ext_typoscript_*.typoscript) at some point.

It usually adds this before the first "root" sys_template
row. This is fine in frontend.

Extbase backend modules rely on frontend TypoScript for
configuration as well. This decision from the dark ages
hurts us plenty, but is very hard to get rid of.

The extbase BackendConfigurationManager does a lot of
guesswork to calculate such frontend TypoScript: There
are various special cases, especially when an extbase
backend module is not loaded within page context.

The ext:form extension triggers such a special case:
When there is only a single page marked as "is_siteroot"
without a sys_template record, configuration from
globals is not included. The configuration is then
incomplete and the module fails.

The old TypoScript parser had a dedicated hack and
toggle for this, which forced it to still include
global configuration. The new TypoScript parser
does not contain this hack. Instead, the extbase
BackendConfigurationManager "fakes" a sys_template
row to trigger the global inclusion. This works if
there is no "is_siteroot" page at all, but is not
triggered when a page could be determined.

The patch slightly changes the extbase logic to also
add the fake row if a page could be determined, but
no sys_template record exists.

Additionally, the ext:form backend controllers now
throw a dedicated exception if configuration is
incomplete.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Kevin Appelt +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Kevin Appelt +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 1011

  1. Christian Kuhn uploaded patch set 1 04/15/23, 09:24

  2. core-ci voted on patch set 1 V +1 04/15/23, 09:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40670

  3. Stefan Bürk voted on patch set 1 V +1 CR +1 04/15/23, 14:56

  4. Kevin Appelt commented on patch set 1 V -1 04/15/23, 22:29

    As far as my very first and short review shows, this patch makes it possible to open the backend module again. BUT: The form configuration (at least not the overrides) does not get applied. The according configuration can be seen in the typoscript module, but the configuration module does not show the modified yaml. I will have a closer look later today, just wanted to make sure this does not get merged if there might remain some issues.
  5. Stefan Bürk voted on patch set 1 V 0 CR 0 04/15/23, 23:01

  6. Kevin Appelt commented on patch set 1 CR -1 04/16/23, 07:32

    Found the issues and it is a nasty one. I do not use sys_template rows but add them via AfterTemplatesHaveBeenDeterminedEvent. --- First: in BackendConfigurationManager the event is only triggered for $pageId > 0, which is not the case if in backend context. Changing that to $pageId >= 0 triggers the Event and my configuration should be loaded, but it doesn't due to the second issue. --- Second: Like b13/bolt does, we check for the current site and do an early return if it's not an instance of Site. See: https://github.com/b13/bolt/blob/main/Classes/TypoScript/AddTypoScriptFromSiteExtensionEvent.php#L38 In backend context, there is no site obviously, but a NullSite. If I add fallback values for the stuff that normally comes from the site configuration (which at least public extensions like bolt might not be able to do) I get my configuration and everything is fine. --- This is a problem I've never thought about before, but it can definitely be a big issue because the configuration of the form framework, for example, in a multisite instance can be completely different for each site or even every page in theory, but only one state can be used in the backend. I don't have a solution for this and this should not be the topic of this issue. In fact, I don't think any useful solution can be found.
  7. Kevin Appelt commented on patch set 1 V +1 CR +1 04/17/23, 13:47

    Okay. Overrides affecting the form framework module, like register new form elements and finisher or allowing additional form definition storage, should be done in ext_typoscript_setup.typoscript and not within setup.typoscript Moving the following code from my setup.typoscript to ext_typoscript_setup.typoscript resolves the issue. In addition due to the meaning of the file it gets more clear, that this is a global configuration and can not be adjusted per site or page. ``` module.tx_form { settings { yamlConfigurations { <some key> = EXT:myformext/Configuration/Yaml/CustomFormSetup.yaml } } } ``` The TYPO3 documentation might need a very clear warning not to put this code inside any setup.typoscript.
  8. Christian Kuhn commented on patch set 1 04/17/23, 13:55

    Reply

    Done
  9. Stefan Bürk voted on patch set 1 V +1 CR +1 04/17/23, 13:56

  10. Christian Kuhn voted on patch set 1 V +2 CR +2 04/17/23, 13:57

  11. Christian Kuhn merged patch set 2 04/17/23, 13:57