From c13147cf534930b448ec93fef84c32ff1e59995e Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 24 Feb 2011 14:08:49 -0800 Subject: [PATCH] Stop arc from destroying files under HPHPi. Summary: Test Plan: Reviewers: CC: --- src/lint/patcher/ArcanistLintPatcher.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lint/patcher/ArcanistLintPatcher.php b/src/lint/patcher/ArcanistLintPatcher.php index eefb8ad6..de687147 100644 --- a/src/lint/patcher/ArcanistLintPatcher.php +++ b/src/lint/patcher/ArcanistLintPatcher.php @@ -106,7 +106,12 @@ final class ArcanistLintPatcher { $new_str = $lint->getReplacementText(); $new_len = strlen($new_str); - $data = substr_replace($data, $new_str, $working_offset, $old_len); + if ($working_offset == strlen($data)) { + // Temporary hack to work around a destructive hphpi issue, see #451031. + $data .= $new_str; + } else { + $data = substr_replace($data, $new_str, $working_offset, $old_len); + } $this->changeCharacterDelta($new_len - $old_len); $this->setDirtyCharacterOffset($orig_offset + $old_len); -- 2.43.0