#107008503 error in backend reports due to missing error parameter; PHP-dependent return value of sprintf
Description
Hello!
Since the update to 12.4.33 the PHP file LabelBag exists, which is used for the reports in the TYPO3 backend (perhaps also for other functions).
Under certain circumstances (special PHP version/settings?) an error is generated here:
Uncaught TYPO3 Exception: 4 arguments are required, 3 given | ArgumentCountError thrown in file vendor/typo3/cms-core/Classes/Localization/LabelBag.php in line 48.
We were only able to reproduce the error on one instance, PHP version 8.1.2-1ubuntu2.21 – the error does not occur with PHP 8.1 under ddev.
The error is triggered by a label (here in German):
Mime-Typ "%s" für Dateierweiterung "%s" nicht zulässig (erwartet: %s)
With the error parameters:
[0] => application/octet-stream [1] => mp3
The error messages or the transferred parameters would therefore have to be adapted.
To avoid the 503, the LabelBag.php can be changed as follows (here as a patch, as we use it now):
diff --git a/vendor/typo3/cms-core/Classes/Localization/LabelBag.php b/vendor/typo3/cms-core/Classes/Localization/LabelBag.php
--- a/vendor/typo3/cms-core/Classes/Localization/LabelBag.php
+++ b/vendor/typo3/cms-core/Classes/Localization/LabelBag.php
@@ -44,14 +44,23 @@
public function compile(LanguageService $languageService): string
{
$label = $languageService->sL($this->key);
- return sprintf(
- $label,
- ...$this->arguments
- ) ?: sprintf(
- 'Error: could not translate key "%s" with value "%s" and %d argument(s)!',
- $this->key,
- $label,
- count($this->arguments)
- );
+ try {
+ $result = sprintf($label, ...$this->arguments);
+
+ return $result ?: sprintf(
+ 'Error: could not translate key "%s" with value "%s" and %d argument(s)!',
+ $this->key,
+ $label,
+ count($this->arguments)
+ );
+ } catch (\ArgumentCountError | \ValueError $e) {
+ return sprintf(
+ 'Error: could not translate key "%s" with value "%s" and %d argument(s)! (Exception: %s)',
+ $this->key,
+ $label,
+ count($this->arguments),
+ $e->getMessage()
+ );
+ }
}
}Reviews 5
- 12.4 90015[TASK] Re-add legacy MimeTypeNotAllowedForFileExtension XLF label
- 13.4 89975[TASK] Re-add legacy MimeTypeNotAllowedForFileExtension XLF label
- 12.4 89966[BUGFIX] Use distinct XLF label for MIME-Type error message
- 13.4 89965[BUGFIX] Use distinct XLF label for MIME-Type error message
- main 89952[BUGFIX] Use distinct XLF label for MIME-Type error message
Related issues 2
History 512
-
Garvin Hicking commented and changed status
NewAccepted priorityShould haveMust have Is Regression 1 <span data-processor="relativetime" data-value="2025-07-01T08:23:08+00:00" > 07/01/25, 08:23 </span> -
Garvin Hicking changed Related to #106916 <span data-processor="relativetime" data-value="2025-07-01T08:28:25+00:00" > 07/01/25, 08:28 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 89952 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2025-07-01T08:31:19+00:00" > 07/01/25, 08:31 </span> -
Gerrit Code Review pushed patch set 2 for main to change 89952 <span data-processor="relativetime" data-value="2025-07-01T09:19:29+00:00" > 07/01/25, 09:19 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 89952 <span data-processor="relativetime" data-value="2025-07-01T11:07:57+00:00" > 07/01/25, 11:07 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 89952 <span data-processor="relativetime" data-value="2025-07-01T11:08:16+00:00" > 07/01/25, 11:08 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 89952 <span data-processor="relativetime" data-value="2025-07-01T13:45:24+00:00" > 07/01/25, 13:45 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 89965 <span data-processor="relativetime" data-value="2025-07-01T17:27:51+00:00" > 07/01/25, 17:27 </span>
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 89966 <span data-processor="relativetime" data-value="2025-07-01T17:28:03+00:00" > 07/01/25, 17:28 </span>
-
Garvin Hicking commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-07-01T17:50:09+00:00" > 07/01/25, 17:50 </span>Applied in changeset commit:2727a6d2af5df187aa0a992eac2f1b848a7c368b.
-
Garvin Hicking changed Related to #107021 <span data-processor="relativetime" data-value="2025-07-02T14:37:37+00:00" > 07/02/25, 14:37 </span>
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:37:44+00:00" > 12/02/25, 14:37 </span>
I’m sorry, I caused this by introducing a new placeholder argument to the message, when a new label identifcator would have needed to be created instead. Because now the translation servers already deliver the new language file with the updated parameter, but the Code of the TYPO3 instance does not recognize it. There has been no release made yet with the PHP relevant changes needed for it to work.
I’ll see how to remedy this by introducing a new key and fixing the current translation.
For now you could edit the german localization XLF file (
core/Resources/Private/Language/de.fileMessages.xlf) and change<trans-unit id="FileUtility.MimeTypeNotAllowedForFileExtension" approved="yes"> <source>Mime-type "%s" not allowed for file extension "%s".</source> <target state="final">Mime-Typ "%s" für Dateierweiterung "%s" nicht zulässig.</target> </trans-unit>