Issue Bug Closed

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

Xavier Perseguers 11/07/23, 14:42 updated 07/09/24, 15:19

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.

Reviews 4

History 712

  1. Xavier Perseguers commented 11/07/23, 14:53

    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.

  2. Gerrit Code Review pushed patch set 1 for main to change 81704 status New Under Review 11/07/23, 14:58

  3. Gerrit Code Review pushed patch set 2 for main to change 81704 11/07/23, 15:25

  4. Xavier Perseguers changed description 11/07/23, 15:27

  5. Gerrit Code Review pushed patch set 1 for 12.4 to change 81663 11/07/23, 16:19

  6. Anonymous commented and changed status Under Review Resolved done 0 % 100 % 11/07/23, 16:25

    Applied in changeset commit:10b2642da9719232aa7302a9e1aef171a55f5b85.

  7. Gerrit Code Review pushed patch set 1 for main to change 81706 status Resolved Under Review 11/08/23, 07:36

  8. Anonymous commented and changed status Under Review Resolved 11/08/23, 08:00

    Applied in changeset commit:2ff00e55f6e1f6af356dbc9fd8b6a2c58c40cb36.

  9. Gerrit Code Review pushed patch set 2 for main to change 81706 status Resolved Under Review 11/08/23, 19:52

  10. Garvin Hicking changed Precedes #102405 11/20/23, 08:29

  11. Georg Ringer commented and changed status Under Review Resolved 06/07/24, 09:32

    seems due hickup of gerrit, the issue has been reopened but actually resolved

  12. Benni Mack changed status Resolved Closed 07/09/24, 15:19