ℹ️ View this commit on Github
👥 Authored by Benni Mack benni@typo3.org
✔️ Merged by Benni Mack benni@typo3.org
Commit message
[!!!][TASK] Remove implicit output buffering from Bootstrap
TYPO3 Bootstrap always started an implicit output buffer as the
very first action, wrapping the entire bootstrap and request
lifecycle. It was meant to swallow accidental stray output (e.g.
warnings or echo/print from ext_localconf.php/ext_tables.php of
third-party extensions) so it would not corrupt AJAX responses or
file downloads. Output buffering on CLI was already disabled again
in a previous change, since it delayed console output until the
process ended and could bloat memory for heavy-output commands.
Since responses are already fully assembled as PSR-7 bodies before
being emitted, this legacy safety net is removed, along with the
now unused method Bootstrap::startOutputBuffering().
CommandApplication now drops any buffer level defensively (e.g. one
opened by third-party extension code during ext_localconf loading)
right before running a command, instead of relying on Bootstrap
having opened exactly one buffer to close.
Resolves: #110250
Releases: main
Change-Id: I06f98577afaa70a6ecebbf312e1d27e1dfb06456
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/94863
Tested-by: Stefan Bürk stefan@buerk.tech
Tested-by: Jochen Roth rothjochen@gmail.com
Reviewed-by: Stefan Bürk stefan@buerk.tech
Reviewed-by: Jochen Roth rothjochen@gmail.com
Tested-by: Benni Mack benni@typo3.org
Tested-by: core-ci typo3@b13.com
Reviewed-by: Benni Mack benni@typo3.org
➕ Added files
15.0/Breaking-110250-RemovedImplicitOutputBufferingFromBootstrap.rst
.. include:: /Includes.rst.txt
.. _breaking-110250-1785315899:
===================================================================
Breaking: #110250 - Remove implicit output buffering from Bootstrap
===================================================================
See :issue:`110250`
Description
===========
The class :php:`\TYPO3\CMS\Core\Core\Bootstrap` no longer wraps the entire
bootstrap and request lifecycle in an implicit output buffer via
:php:`ob_start()`. This buffer was historically opened as the very first
action in :php:`Bootstrap::init()` to swallow accidental stray output
(warnings, notices or stray :php:`echo`/:php:`print` statements, typically
from :php:`ext_localconf.php`/:php:`ext_tables.php` of third-party
extensions) so it would not corrupt AJAX responses or file downloads. On
CLI this buffering was already disabled again in a previous change, as it
delayed console output until the process ended and could bloat memory for
commands producing a lot of output.
Since responses are fully assembled as PSR-7 message bodies before being
emitted, this legacy safety net is not needed anymore.
Along with it, the now unused method
:php:`Bootstrap::startOutputBuffering()` has been removed.
Impact
======
Any stray output produced during bootstrap (for example from
:php:`ext_localconf.php`) is now sent to the client directly instead of
being silently discarded later on. This mainly affects binary/file
responses and AJAX requests, which relied on the buffer being cleaned
right before the response body was emitted.
Calling :php:`Bootstrap::startOutputBuffering()` now results in a fatal
PHP error (:php:`Call to undefined method`).
Affected installations
======================
TYPO3 installations with extensions that produce accidental output during
:php:`ext_localconf.php`/:php:`ext_tables.php` loading, which so far was
silently swallowed, and installations with custom entry point scripts
calling :php:`Bootstrap::startOutputBuffering()` directly.
Migration
=========
Remove any accidental output from :php:`ext_localconf.php` and
:php:`ext_tables.php` files. Extensions that need to suppress their own
output must manage output buffering (:php:`ob_start()` /
:php:`ob_end_clean()`) themselves.
Remove calls to :php:`Bootstrap::startOutputBuffering()` and use
:php:`ob_start()` directly, if the behaviour is still required.
.. index:: PHP-API, FullyScanned, ext:core
ℹ️ View this commit on Github
👥 Authored by Benni Mack benni@typo3.org
✔️ Merged by Benni Mack benni@typo3.org
Commit message
[!!!][TASK] Remove implicit output buffering from Bootstrap
TYPO3 Bootstrap always started an implicit output buffer as the
very first action, wrapping the entire bootstrap and request
lifecycle. It was meant to swallow accidental stray output (e.g.
warnings or echo/print from ext_localconf.php/ext_tables.php of
third-party extensions) so it would not corrupt AJAX responses or
file downloads. Output buffering on CLI was already disabled again
in a previous change, since it delayed console output until the
process ended and could bloat memory for heavy-output commands.
Since responses are already fully assembled as PSR-7 bodies before
being emitted, this legacy safety net is removed, along with the
now unused method Bootstrap::startOutputBuffering().
CommandApplication now drops any buffer level defensively (e.g. one
opened by third-party extension code during ext_localconf loading)
right before running a command, instead of relying on Bootstrap
having opened exactly one buffer to close.
Resolves: #110250
Releases: main
Change-Id: I06f98577afaa70a6ecebbf312e1d27e1dfb06456
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/94863
Tested-by: Stefan Bürk stefan@buerk.tech
Tested-by: Jochen Roth rothjochen@gmail.com
Reviewed-by: Stefan Bürk stefan@buerk.tech
Reviewed-by: Jochen Roth rothjochen@gmail.com
Tested-by: Benni Mack benni@typo3.org
Tested-by: core-ci typo3@b13.com
Reviewed-by: Benni Mack benni@typo3.org
➕ Added files
15.0/Breaking-110250-RemovedImplicitOutputBufferingFromBootstrap.rst