]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use string operations, not idx(), for string indexing.
authorepriestley <git@epriestley.com>
Wed, 29 Feb 2012 16:39:25 +0000 (08:39 -0800)
committerepriestley <git@epriestley.com>
Wed, 29 Feb 2012 16:39:25 +0000 (08:39 -0800)
Summary: Missed this in review (D1715), idx() does not operate on strings (maybe
it does in HPHP/i?).

Test Plan: Faked an editable lint warning, ran "arc lint".

Reviewers: Koolvin, andrewjcg, btrahan

Reviewed By: Koolvin

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1728

src/lint/renderer/ArcanistLintRenderer.php

index f8a458caaf0eb1fc615674c16cff21f70514a0bd..fa966fe119639e688659ed0b3b8df95235f6be83 100644 (file)
@@ -160,7 +160,7 @@ final class ArcanistLintRenderer {
     if ($message->isPatchable()) {
       // Strip trailing newlines, since "explode" will create an extra patch
       // line for these.
-      if (idx($patch, strlen($patch) - 1, null) === "\n") {
+      if (strlen($patch) && ($patch[strlen($patch) - 1] === "\n")) {
         $patch = substr($patch, 0, -1);
       }
       $patch_lines = explode("\n", $patch);