Commit 3a7c8b13 authored by Benni Mack's avatar Benni Mack
Browse files

[!!!][TASK] Remove typoscript option config.disableCharsetHeader

This option is obsolete nowadays, as PSR-7 is setting
the headers at the end of the script / when emitting
a Response, this way the header can be modified at any time.

Resolves: #97550
Releases: main
Change-Id: I0602e4fd0a20461d49a554f66f36442894e96fd4

Tested-by: core-ci's avatarcore-ci <>
Tested-by: Georg Ringer's avatarGeorg Ringer <>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <>
Tested-by: default avatarJosef Glatz <>
Tested-by: Benni Mack's avatarBenni Mack <>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <>
Reviewed-by: Benni Mack's avatarBenni Mack <>
parent ae00ad42
.. include:: /Includes.rst.txt
.. _breaking-97550-1651697278
Breaking: #97550 - TypoScript option config.disableCharsetHeader removed
See :issue:`97550`
The TypoScript flag :ts:`config.disableCharsetHeader` has been completely removed
from TYPO3 Core.
This option was used to avoid sending HTTP headers of type "Content-Type" to
the client. This flag was mainly used to overcome a technical limitation to
override the Content-Type information back in TYPO3 v4.x.
TYPO3 now always sends the `Content-Type` header to the client in the TYPO3
Affected installations
TYPO3 installations having this option enabled via TypoScript.
It is not needed to set this option. Even when Extbase plugins return JSON-based
Responses, the Content-Type header is already modified.
In special cases, when custom headers are required, it is possible to modify
the headers via a PHP-based PSR-15 middleware, or via TypoScript with
.. index:: TypoScript, NotScanned, ext:frontend
......@@ -163,24 +163,13 @@ class Bootstrap
// In case TSFE is available and this is a json response, we have
// to take the TypoScript settings regarding charset into account.
// @todo Since HTML5 only utf-8 is a valid charset, this settings should be deprecated
// In case TSFE is available and this is a json response, we have to let TSFE know we have a specific Content-Type
if (($typoScriptFrontendController = ($GLOBALS['TSFE'] ?? null)) instanceof TypoScriptFrontendController
&& str_starts_with($response->getHeaderLine('Content-Type'), 'application/json')
) {
// Unset the already defined Content-Type
// Do not send the header directly (see below)
$response = $response->withoutHeader('Content-Type');
if (empty($typoScriptFrontendController->config['config']['disableCharsetHeader'])) {
// If the charset header is *not* disabled in configuration,
// TypoScriptFrontendController will send the header later with the Content-Type which we set here.
} else {
// Although the charset header is disabled in configuration, we *must* send a Content-Type header here.
// Content-Type headers optionally carry charset information at the same time.
// Since we have the information about the charset, there is no reason to not include the charset information although disabled in TypoScript.
$response = $response->withHeader('Content-Type', 'application/json; charset=utf-8');
if (headers_sent() === false) {
......@@ -2165,10 +2165,8 @@ class TypoScriptFrontendController implements LoggerAwareInterface
public function applyHttpHeadersToResponse(ResponseInterface $response): ResponseInterface
// Set header for charset-encoding unless disabled
if (empty($this->config['config']['disableCharsetHeader'])) {
$response = $response->withHeader('Content-Type', $this->contentType . '; charset=utf-8');
// Set header for content-type + charset-encoding
$response = $response->withHeader('Content-Type', $this->contentType . '; charset=utf-8');
// Set header for content language unless disabled
$contentLanguage = $this->language->getTwoLetterIsoCode();
if (empty($this->config['config']['disableLanguageHeader']) && !empty($contentLanguage)) {
......@@ -315,11 +315,6 @@ This value is overridden by the value set in the page-record (field="cache_timeo
Use this feature in templates supplying other content-types than HTML. That could be an image or a WAP-page!]]></description>
<property name="disableCharsetHeader" type="boolean">
<description><![CDATA[By default a HTTP header "Content-Type: text/html; charset..." is sent. This option will disable that.]]></description>
<property name="disablePrefixComment" type="boolean">
<description><![CDATA[If set, the stdWrap property "prefixComment" will be disabled, thus preventing any revealing and spaceconsuming comments in the HTML source code.]]></description>
......@@ -255,7 +255,6 @@
'disableAllHeaderCode': kw('disableAllHeaderCode'),
'disableAltText': kw('disableAltText'),
'disableBodyTag': kw('disableBodyTag'),
'disableCharsetHeader': kw('disableCharsetHeader'),
'disabled': kw('disabled'),
'disableDelete': kw('disableDelete'),
'disableHideAtCopy': kw('disableHideAtCopy'),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment