Escape % chars in user input before passing to sprintf, fixes #11359
parent
8beb64d82c
commit
b4c1be6cb6
|
@ -126,6 +126,7 @@ class Problem
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
$message = $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
|
$message = $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
|
||||||
if (in_array($rule->getReason(), $deduplicatableRuleTypes, true) && Preg::isMatch('{^(?P<package>\S+) (?P<version>\S+) (?P<type>requires|conflicts)}', $message, $m)) {
|
if (in_array($rule->getReason(), $deduplicatableRuleTypes, true) && Preg::isMatch('{^(?P<package>\S+) (?P<version>\S+) (?P<type>requires|conflicts)}', $message, $m)) {
|
||||||
|
$message = str_replace('%', '%%', $message);
|
||||||
$template = Preg::replace('{^\S+ \S+ }', '%s%s ', $message);
|
$template = Preg::replace('{^\S+ \S+ }', '%s%s ', $message);
|
||||||
$messages[] = $template;
|
$messages[] = $template;
|
||||||
$templates[$template][$m[1]][$parser->normalize($m[2])] = $m[2];
|
$templates[$template][$m[1]][$parser->normalize($m[2])] = $m[2];
|
||||||
|
|
Loading…
Reference in New Issue