#102045The LocalizationUtility should handle ValueError Exceptions thrown by sprintf
Description
see https://forge.typo3.org/issues/102044see 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 1
Related issues 1
History 4
-
Garvin Hicking changed Related to #106402 <span data-processor="relativetime" data-value="2025-04-24T14:52:35+00:00" > 04/24/25, 14:52 </span>
-
Garvin Hicking commented and changed status
NewClosed <span data-processor="relativetime" data-value="2025-04-24T14:54:00+00:00" > 04/24/25, 14:54 </span>I’d prefer to close this as #106402 has some
Discussion and a patch attached (which has negative votes), can we take it there?
I just had a use case which I think was related.
ERROR] request="9b4fb39a4b131" component="TYPO3.CMS.Scheduler.Scheduler": Task failed to execute successfully. Class: Cobweb\ExternalImport\Task\AutomatedSyncTask, UID: 3, Code: 0, "4 arguments are required, 3 given" in /var/www/.../vendor/typo3/cms-extbase/Classes/Utility/LocalizationUtility.php at line 91- ArgumentCountError: 4 arguments are required, 3 given, in file /var/www/.../vendor/typo3/cms-extbase/Classes/Utility/LocalizationUtility.php:91 - {"taskClass":"Cobweb\\ExternalImport\\Task\\AutomatedSyncTask","taskId":3,"exception":"ArgumentCountError: 4This argument count error in sprintf was breaking our automatic imports.