Project

General

Profile

Actions

Bug #102343

open

Empty $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] leads to Internal Server Error

Added by Xavier Perseguers 7 months ago. Updated 7 months ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
-
Start date:
2023-11-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

After uploading a PDF file in File > Filelist with TYPO3 v12, I could not show the directory anymore, it always fails with "500 - Internal Server Error".

Nothing in logs, nor in php.log, Development environment, ...

I tracked the problem down to \TYPO3\CMS\Core\Utility\CommandUtility::escapeShellArguments():447 where the call

setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);

is the culprit.

It turns out systemLocale is empty on that development environment.

That calls is done when $GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] is true.

After setting systemLocale to en_US.UTF-8, the call doesn't fail anymore and everything's fine.

=> this kind of misconfiguration should not cause a very hard to debug Internal Server Error.

=> maybe the resolution may be backported.


Related issues 1 (0 open1 closed)

Precedes TYPO3 Core - Bug #102405: Followup: Empty $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] leads to Internal Server ErrorResolved2023-11-082023-11-08

Actions
Actions #1

Updated by Xavier Perseguers 7 months ago

Doing this "fixes" the problem:

            if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'])) {
                throw new \RuntimeException('$GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'systemLocale\'] is empty.', 1699368597);
            }
            setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);

Note: the RuntimeException is catched by TYPO3 when generating trying to generate the thumbnail (well, firstly when invoking "identify" on the PDF) and no error is shown, but the faulty call to setlocale is prevented and there is no more Internal Server Error crash.

Actions #2

Updated by Gerrit Code Review 7 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81704

Actions #3

Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81704

Actions #4

Updated by Xavier Perseguers 7 months ago

  • Description updated (diff)
Actions #5

Updated by Gerrit Code Review 7 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81663

Actions #6

Updated by Anonymous 7 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Gerrit Code Review 7 months ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81706

Actions #8

Updated by Anonymous 7 months ago

  • Status changed from Under Review to Resolved
Actions #9

Updated by Gerrit Code Review 7 months ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81706

Actions #10

Updated by Garvin Hicking 6 months ago

  • Precedes Bug #102405: Followup: Empty $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] leads to Internal Server Error added
Actions

Also available in: Atom PDF