#106402Critical error in LocalizationUtility.php when accessing Backend Users in Spanish
Description
In TYPO3 v12.4.28 with PHP 8.4, a critical error occurs in LocalizationUtility.php when accessing the “Usuarios de backend” module with the backend language set to Spanish. The issue seems to be caused by an invalid format specifier in a translation string.
Log output:
[CRITICAL] request=“422d3a6447131” component=“TYPO3.CMS.Core.Error.ProductionExceptionHandler”: Core: Exception handler (WEB: BE): ValueError, code #0, file /var/www/cms_typo3/vendor/typo3/cms-extbase/Classes/Utility/LocalizationUtility.php, line 91: Unknown format specifier “?”
Steps to reproduce
Set the TYPO3 backend language to Spanish.
Go to TYPO3 Backend > Usuarios de backend.
TYPO3 crashes with a ValueError: Unknown format specifier “?”.
Expected behavior
Instead of throwing a critical error, the system should handle incorrect placeholders gracefully.
Suggested Fix
Modify LocalizationUtility.php (lines 87-93) to validate placeholders before calling sprintf().
Current code:
if (is_array($arguments) && $arguments !== [] && $value !== null) {
return sprintf($value, …array_values($arguments)) ?: sprintf(
‘Error: could not translate key “%s” with value “%s” and %d argument(s)!’,
$key,
$value,
count($arguments)
);
}
Proposed fix:
if (is_array($arguments) && $arguments !== [] && strpos($value, ‘‘) !== false) {
preg_match_all(‘/[a-zA-Z]/’, $value, $matches);
if (count($matches0) !== count($arguments)) {
return sprintf(‘Error: could not translate key “%s” with value “%s” and %d argument(s)!’, $key, $value, count($arguments));
}
}
Reviews 1
Related issues 3
- Task #102045The LocalizationUtility should handle ValueError Exceptions thrown by sprintf
- Bug #108424Backend login crashes with ValueError in sprintf() when German translation is used (invalid format string for free_software_and_warranty)
- Bug #108427TYPO3 backend login broken when xlf file not translated properly
Files 2
History 89
-
Josué Gutiérrez Carrillo changed description <span data-processor="relativetime" data-value="2025-03-20T13:53:51+00:00" > 03/20/25, 13:53 </span>
-
Georg Ringer commented and changed attached Bildschirmfoto 2025-03-20 um 15.27.54.png status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-03-20T14:31:05+00:00" > 03/20/25, 14:31 </span> -
Gerrit Code Review pushed patch set 1 for main to change 88661 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2025-03-20T19:18:59+00:00" > 03/20/25, 19:18 </span> -
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-03-20T19:35:37+00:00" > 03/20/25, 19:35 </span>
I would also love to understand which exact language key is causing the trouble here so that we might fix that on translation servers.
I’ve created the linked patch with an alternate approach to your idea, by working with catching the possible two types of exceptions that sprintf() may throw. If you would be able to check out that patch, that would be great.
Thanks for bringing this up, this is very helpful!
-
Josué Gutiérrez Carrillo commented <span data-processor="relativetime" data-value="2025-03-21T08:55:57+00:00" > 03/21/25, 08:55 </span>
Garvin Hicking wrote in #note-4:
> I would also love to understand which exact language key is causing the trouble here so that we might fix that on translation servers.
>
> I’ve created the linked patch with an alternate approach to your idea, by working with catching the possible two types of exceptions that sprintf() may throw. If you would be able to check out that patch, that would be great.
>
> Thanks for bringing this up, this is very helpful!Hi Garvin,
Thanks a lot for the quick fix! It’s working perfectly now. I hope it gets approved smoothly, and I’ll be looking forward to the next update.
Best regards!
-
Garvin Hicking changed Related to #102045 <span data-processor="relativetime" data-value="2025-04-24T14:52:35+00:00" > 04/24/25, 14:52 </span>
-
Garvin Hicking changed Related to #108427 <span data-processor="relativetime" data-value="2025-12-08T13:52:44+00:00" > 12/08/25, 13:52 </span>
-
Garvin Hicking changed Related to #108424 <span data-processor="relativetime" data-value="2025-12-08T19:39:13+00:00" > 12/08/25, 19:39 </span>
-
Garvin Hicking changed status
Under ReviewClosed <span data-processor="relativetime" data-value="2026-09-01T06:04:16+00:00" > 09/01/26, 06:04 </span>
thanks for creating the issue. I couldn’t reproduce that on main or 12.4.28 using latest downloads of spanish backend
Bildschirmfoto%202025-03-20%20um%2015.27.54.png
can you check which string is the culprit and maybe also test on a clean system?