Review main Merged

91321[BUGFIX] Ensure output compression handler is only initialized once

Oliver Hader CR +2 V +2 Easy +3 −1 updated 10/29/25, 14:39

Commit message

The middleware `SudoModeInterceptor::handleRequestGrantedException()`
invokes `TYPO3\CMS\Core\Http\Application` again when picking up the
previous HTTP non-GET request. This triggers the initialization of the
`OutputCompression` middleware again, causing a PHP warning concerning
the active `ob_gzhandler`.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Oliver Klee +1
    • Markus Klein +1
    • Christian Kuhn +1
    • Sebastian Iffland +1
    • Mathias Brodala +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Markus Klein +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 2124

  1. Oliver Hader uploaded patch set 1 10/29/25, 09:08

  2. core-ci voted on patch set 1 V +1 10/29/25, 09:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87919

  3. Oliver Hader updated the commit message in patch set 2 V +1 10/29/25, 09:46

  4. Oliver Hader commented on patch set 2 10/29/25, 09:46

    This change is ready for review.
  5. Mathias Brodala commented on patch set 2 10/29/25, 09:50

    OutputCompression.php:65

    Do we need this additional flag even though you already do the ob_list_handlers() check above? If you do that check earlier here, you can return early.
  6. Oliver Hader commented on patch set 2 10/29/25, 09:54

    OutputCompression.php:65 Reply

    `ob_gzhandler` might be initialized by some other (custom) middleware. The method also assigns `zlib.output_compression_level` above - that's why I did not move the `ob_gzhandler` check to the other `isInitialized` check at the beginning of this method.
  7. core-ci voted on patch set 2 V +1 10/29/25, 09:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87924

  8. Sebastian Iffland voted on patch set 2 CR +1 10/29/25, 10:00

  9. Mathias Brodala commented on patch set 2 10/29/25, 10:02

    OutputCompression.php:65 Reply

    Feels like things could be streamlined here but I get what you mean. Still feels not completely right to make this middleware stateful.
  10. Markus Klein commented on patch set 2 CR +1 10/29/25, 10:13

    OutputCompression.php:65 Reply

    It's not the middleware that's stateful. It's the global state that ob_* handler stuff creates.
  11. Markus Klein voted on patch set 2 V +1 10/29/25, 10:22

  12. Christian Kuhn voted on patch set 2 CR +1 V +1 10/29/25, 11:02

  13. Oliver Hader commented on patch set 2 10/29/25, 12:05

    OutputCompression.php:65 Reply

    That's a valid point, of not making the middleware stateful. Thus, we probably should only focus on the reported PHP warning concerning initializing the `ob_gzhandler` again...
  14. Oliver Hader uploaded patch set 3 CR +1 V +1 10/29/25, 12:20

  15. Oliver Hader commented on patch set 3 10/29/25, 12:20

    OutputCompression.php:65 Reply

    Done
  16. core-ci voted on patch set 3 V +1 10/29/25, 12:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87959

  17. Mathias Brodala voted on patch set 3 CR +1 10/29/25, 12:36

  18. Sebastian Iffland voted on patch set 3 CR +1 10/29/25, 12:37

  19. Christian Kuhn voted on patch set 3 CR +1 V +1 10/29/25, 12:38

  20. Christian Kuhn commented on patch set 3 10/29/25, 12:38

    OutputCompression.php:65 Reply

    much better!
  21. Markus Klein voted on patch set 3 CR +1 V +1 10/29/25, 14:19

  22. Oliver Hader voted on patch set 3 CR +2 V +2 10/29/25, 14:38

  23. Oliver Klee voted on patch set 3 CR +1 10/29/25, 14:39

  24. Oliver Hader merged patch set 4 10/29/25, 14:39