Skip to content

Commit

Permalink
[BUGFIX] Fix sprintf() PHP warning in FinisherOptionGenerator
Browse files Browse the repository at this point in the history
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/+/72901
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
  • Loading branch information
bnf committed Jan 7, 2022
1 parent c9c56e4 commit fab061b
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -90,10 +90,11 @@ public function __invoke(string $_, $__, array $matches)
}

if (empty($optionValue)) {
$elementConfiguration['label'] .= sprintf(' (%s: "%s")', $this->languageService->getLL('default'), $this->languageService->getLL('empty'));
} else {
$elementConfiguration['label'] .= sprintf(' (%s: "' . $optionValue . '")', $this->languageService->getLL('default'));
$optionValue = $this->languageService->getLL('empty');
} elseif (is_array($optionValue)) {
$optionValue = implode(',', $optionValue);
}
$elementConfiguration['label'] .= sprintf(' (%s: "%s")', $this->languageService->getLL('default'), $optionValue);

if (isset($elementConfiguration['config'])) {
$elementConfiguration['config']['default'] = $optionValue;

This comment has been minimized.

Copy link
@brandung-sjorek

brandung-sjorek Jun 17, 2022

The Line 93 + Line 100 (the numbering of the right side) create a regression …

This comment has been minimized.

Copy link
@tritum

tritum Jun 17, 2022

@brandung-sjorek can you please create a new issue on https://forge.typo3.org/projects/typo3cms-core/issues/new? That would be great! Providing some more details does also help to get the problem quickly fixed. Thanks!

This comment has been minimized.

Copy link
@brandung-sjorek

brandung-sjorek Jun 17, 2022

Expand Down

0 comments on commit fab061b

Please sign in to comment.