Commit 0c596db6 authored by Benjamin Franzke's avatar Benjamin Franzke
Browse files

[BUGFIX] Fix sprintf() PHP warning in FinisherOptionGenerator

User supplied strings must not be concatenated into the format
parameter of sprintf() as sequences like %s, or (more likely) %20S
(which is ' S' url escaped) may be contained and cause warnings
because sprintf() expects additional arguments in that case.

Streamline to always use the static '%s: "%s"' format instead.

Releases: main, 11.5, 10.4
Resolves: #96478
Change-Id: Ic3b09c6e1e7c617e78ea405289680bd78d0aab64
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72900

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
parent ee4fe560
......@@ -79,13 +79,11 @@ class FinisherOptionGenerator extends AbstractProcessor
$languageService = $this->getLanguageService();
$elementConfiguration['label'] = (string)($elementConfiguration['label'] ?? '');
if (empty($optionValue)) {
$elementConfiguration['label'] .= sprintf(' (%s: "%s")', $languageService->getLL('default'), $languageService->getLL('empty'));
} else {
if (is_array($optionValue)) {
$optionValue = implode(',', $optionValue);
}
$elementConfiguration['label'] .= sprintf(' (%s: "' . $optionValue . '")', $languageService->getLL('default'));
$optionValue = $languageService->getLL('empty');
} elseif (is_array($optionValue)) {
$optionValue = implode(',', $optionValue);
}
$elementConfiguration['label'] .= sprintf(' (%s: "%s")', $languageService->getLL('default'), $optionValue);
$sheetElements = $this->converterDto->getResult();
if ($elementConfiguration['section'] ?? false) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment