Review main Merged

84187[BUGFIX] Avoid executing anonymous function in Configuration Module

Stefan Bürk CR +2 V +2 Easy +6 −0 updated 05/10/24, 17:22

Commit message

Hook implementation are configured with the well known

    $GLOBAL['TYPO3_CONF_VARS']['SC_OPTIONS'][...][] = '';

syntax since ages. Directly defining an anonymous callback function
is undocumented and rarely used, but technical valid and supported
by the `GeneralUtility::callUserFunction()` method.

Due to the refactoring of the `ext:lowlevel` Configuration module
for the revamped TypoScript parser with TYPO3 v12 the code in the
`ConfigurationController` has been modified to do an array cast,
which triggers the execution of the function - which can lead to
some deep recursions and thus exceeding server resource limits.

Direct callback function should not be executed within the backend
Configuration module, which literally is a invalid execution of them.

Following code in a extension `ext_localconf.php` file will lead to
the resource limit issue:

    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']
        ['tslib/index_ts.php']['preprocessRequest'][]
            = function($parameters, $parent) {};

This change modifies the `ConfigurationController->renderTree()` to
check if a value is a callable and display the information, and in
case of an anonymous function (`Closure::__invoke`) add additional
static information:

   Closure::__invoke (anonymous callback function: function() {})

Note: That does not make it obvious where the function is defined,
but it avoids calling these callback methods.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Torben Hansen +1
    • Nikita Hovratov +1
    • Stefan Froemken +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Torben Hansen +1
    • Nikita Hovratov +1
    • Stefan Froemken +1
    • core-ci +1 CI

Issues 2

Files 1

Review log 811

  1. Stefan Bürk uploaded patch set 1 05/10/24, 13:30

  2. Stefan Bürk updated the commit message in patch set 2 05/10/24, 13:32

  3. core-ci voted on patch set 1 V +1 05/10/24, 13:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57480

  4. core-ci voted on patch set 2 V +1 05/10/24, 13:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57482

  5. Stefan Bürk updated the commit message in patch set 3 V +1 05/10/24, 13:51

  6. Stefan Froemken commented on patch set 3 CR +1 V +1 05/10/24, 13:52

    Nice one. Tested with the source code at customers installation. Works now. Good job.
  7. core-ci voted on patch set 3 V +1 05/10/24, 13:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57485

  8. Torben Hansen voted on patch set 3 CR +1 V +1 05/10/24, 16:24

  9. Nikita Hovratov voted on patch set 3 CR +1 V +1 05/10/24, 16:56

  10. Stefan Bürk voted on patch set 3 CR +2 V +2 05/10/24, 17:15

  11. Stefan Bürk merged patch set 4 05/10/24, 17:22