From: James Rhodes Date: Thu, 15 May 2014 00:11:45 +0000 (-0700) Subject: Fix issue where message contained % but wasn't intended for use with parameters X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=fcdacc28b8a2b2994446a25e6a1a421926ea35e7;p=arcanist.git Fix issue where message contained % but wasn't intended for use with parameters Summary: This fixes an issue with the C# linter where a message could be returned from cslint that wasn't intended for use with parameters. This just ensures there's enough parameters so that it won't crash (and consequently ignore lint messages). Test Plan: Ran the linter, it didn't crash. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9116 --- diff --git a/src/lint/linter/ArcanistCSharpLinter.php b/src/lint/linter/ArcanistCSharpLinter.php index b0b7b244..aaedab86 100644 --- a/src/lint/linter/ArcanistCSharpLinter.php +++ b/src/lint/linter/ArcanistCSharpLinter.php @@ -207,8 +207,11 @@ final class ArcanistCSharpLinter extends ArcanistLinter { $message->setChar($issue->Column); $message->setOriginalText($issue->OriginalText); $message->setReplacementText($issue->ReplacementText); - $message->setDescription( - vsprintf($issue->Index->Message, $issue->Parameters)); + $desc = @vsprintf($issue->Index->Message, $issue->Parameters); + if ($desc === false) { + $desc = $issue->Index->Message; + } + $message->setDescription($desc); $severity = ArcanistLintSeverity::SEVERITY_ADVICE; switch ($issue->Index->Severity) { case 0: