Issue Task Closed

#102045The LocalizationUtility should handle ValueError Exceptions thrown by sprintf

Philipp Wrann 09/27/23, 08:39 updated 04/24/25, 14:54

Description

see https://forge.typo3.org/issues/102044
see https://www.php.net/manual/en/function.sprintf.php

Since PHP 8.0 sprintf throws ValueError Exceptions insteadof triggering a warning.

At the moment a ValueError is thrown and ultimately only catched by the RequestHandler, which results in a generic 500/503 Error page with a not so verbose error message (even in development).

It would be better, if the LocalizationUtility would catch ValueError Exceptions thrown by PHP, log them in a very verbose way (The translation string for the entity ‘{fullIdentifier}’ is malformed: {originalValueError}). It should then also take alternativeLanguageKeys into account (as fallback) and finally return a blank string so fallback handling can kick in.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.