@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix an invalid index access for synthetic lint inline comments from Harbormaster

Summary:
Ref T13524. If a Harbormaster lint message has no line number (which is permitted), we try to access an invalid index here. This is an exception after D21044.

Treat comments with no line number as unchanged. These comments do not have "ghost" behavior and do not port across diffs.

Test Plan:
- Used "harbormaster.sendmessage" to submit lint with no line number on a changeset.
- Viewed changeset.
- Before patch: "Undefined index: <null>" error.
- After patch: Clean changeset with lint message.

{F7400072}

Maniphest Tasks: T13524

Differential Revision: https://secure.phabricator.com/D21178

+8 -4
+8 -4
src/applications/differential/parser/DifferentialChangesetParser.php
··· 980 980 $new_side = $this->isCommentOnRightSideWhenDisplayed($comment); 981 981 982 982 $line = $comment->getLineNumber(); 983 - if ($new_side) { 984 - $back_line = $new_backmap[$line]; 983 + 984 + // See T13524. Lint inlines from Harbormaster may not have a line 985 + // number. 986 + if ($line === null) { 987 + $back_line = null; 988 + } else if ($new_side) { 989 + $back_line = idx($new_backmap, $line); 985 990 } else { 986 - $back_line = $old_backmap[$line]; 991 + $back_line = idx($old_backmap, $line); 987 992 } 988 993 989 994 if ($back_line != $line) { ··· 1002 1007 1003 1008 $comment->setLineNumber($back_line); 1004 1009 $comment->setLineLength(0); 1005 - 1006 1010 } 1007 1011 1008 1012 $start = max($comment->getLineNumber() - $lines_context, 0);