Project

General

Profile

Actions

Bug #95683

closed

TYPO3's Backend login presents an HTTP 500 if "Accept-Language" is omitted

Added by Christian Spoo about 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
System/Bootstrap/Configuration
Target version:
-
Start date:
2021-10-17
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Currently, TYPO3 (tested with 11.5.1) throws an exception when it encounters a request lacking an Accept-Language header. You can test this e.g. with HTTPie, such as:

$ http --print hH https://develop.review.mfc.gmbh/typo3/
GET /typo3/ HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: develop.review.mfc.gmbh
User-Agent: HTTPie/2.4.0

HTTP/1.1 500 Internal Server Error
Connection: keep-alive
Content-Type: text/html; charset=UTF-8
Date: Sun, 17 Oct 2021 19:56:51 GMT
Referrer-policy: same-origin
Server: nginx/1.19.2
Strict-Transport-Security: max-age=15724800; includeSubDomains
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Powered-By: PHP/8.0.11
X-UA-Compatible: IE=edge

whereas

$ http --print hH https://develop.review.mfc.gmbh/typo3/ "Accept-Language: de" 
GET /typo3/ HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: de
Connection: keep-alive
Host: develop.review.mfc.gmbh
User-Agent: HTTPie/2.4.0

HTTP/1.1 200 OK
Cache-Control: no-cache, must-revalidate
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 3107
Content-Type: text/html; charset=utf-8
Date: Sun, 17 Oct 2021 20:01:39 GMT
Expires: 0
Last-Modified: Sun, 17 Oct 2021 20:01:39 GMT
Pragma: no-cache
Referrer-policy: same-origin
Server: nginx/1.19.2
Set-Cookie: be_typo_user=deleted; expires=Sat, 17-Oct-2020 20:01:38 GMT; Max-Age=0; path=/; httponly; samesite=lax
Strict-Transport-Security: max-age=15724800; includeSubDomains
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Powered-By: PHP/8.0.11
X-UA-Compatible: IE=edge

This is due to the following lines in \TYPO3\CMS\Backend\Controller\LoginController:

        $httpAcceptLanguage = $request->getServerParams()['HTTP_ACCEPT_LANGUAGE'];
        $preferredBrowserLanguage = GeneralUtility::makeInstance(Locales::class)->getPreferredClientLanguage($httpAcceptLanguage);

However, the presence of an Accept-Language is IMHO not a strict requirement in a valid HTTP request (although most browsers will include it). Hence, TYPO3 should fallback gracefully to one of its available backend languages (such as English) if the client does not provide a preference.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #95625: Avoid warning from optional HTTP_ACCEPT_LANGUAGEClosed2021-10-13

Actions
Actions

Also available in: Atom PDF