Review main Ready for review Stale

94983[FEATURE] Allow configuring the Fluid error handler

Benni Mack CR -1 V 0 Hard +358 −0 updated 08/06/26, 22:54

Commit message

An exception raised by a single ViewHelper aborts the rendering of
the whole Fluid template. Depending on the project this is either
exactly what should happen, or an overreaction: a missing image
file should usually not take down a page that is otherwise
perfectly renderable.

Fluid has a concept for this, the ErrorHandlerInterface, which is
consulted by the ViewHelperInvoker for every ViewHelper call, in
uncached as well as in compiled templates. TYPO3 did not provide a
way to influence which implementation is used, so the throwing
default was always in effect and the only way out was to copy the
affected ViewHelpers.

The implementation can now be selected via

  $GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['errorHandler']

and is applied by RenderingContextFactory, so it takes effect for
every Fluid view in the installation. It is resolved from the
container and therefore has to be registered as a public service,
which is validated with a speaking exception.

Next to the throwing StandardErrorHandler, which stays the default
and keeps the current behavior, and Fluid's TolerantErrorHandler,
a new LoggingErrorHandler is provided. It logs errors raised by
ViewHelpers and renders nothing in their place, while re-throwing
parser, expression and view errors, as those indicate an error in
the template itself rather than in the data it works on.

In failsafe mode (install tool) the default error handler is always
used, as custom implementations can not be retrieved from the
symfony container there.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 2
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/83/94983/2 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/83/94983/2 && git cherry-pick FETCH_HEAD

Review

  • Code review CR -1 Needs a vote
    • Simon Praetorius -1
    • Andreas Wolf +1
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Merge conflicts 18

Issues 1

Files 7

Review log 57

  1. Benni Mack uploaded patch set 1 07/29/26, 12:29

  2. Benni Mack updated the commit message in patch set 2 07/29/26, 12:30

  3. core-ci voted on patch set 1 V +1 07/29/26, 12:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105595

  4. core-ci voted on patch set 2 V +1 07/29/26, 12:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105596

  5. Benni Mack marked it ready for review 08/06/26, 18:24

  6. Andreas Wolf voted on patch set 2 CR +1 08/06/26, 20:19

  7. Simon Praetorius commented on patch set 2 CR -1 08/06/26, 22:54

    RenderingContextFactory.php:123 Unresolved

    I'd prefer to use proper DI here if at all possible. Ideally, we could get rid of all fluid-related TYPO3_CONF_VARS options and provide them either via DI with interfaces (which should be possible in this case) or create separate config files in Configuration/Fluid on extension level. Due to the failsafe container, this might require manual wiring in ServiceProvider.php, but we've already done this in other cases.