From: epriestley Date: Wed, 29 Feb 2012 16:39:25 +0000 (-0800) Subject: Use string operations, not idx(), for string indexing. X-Git-Tag: conduit-4~134 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=b3a70ac2069f2de0fa79eb5849d7841cdb643a4e;p=arcanist.git Use string operations, not idx(), for string indexing. 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 --- diff --git a/src/lint/renderer/ArcanistLintRenderer.php b/src/lint/renderer/ArcanistLintRenderer.php index f8a458ca..fa966fe1 100644 --- a/src/lint/renderer/ArcanistLintRenderer.php +++ b/src/lint/renderer/ArcanistLintRenderer.php @@ -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);