]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Stop arc from destroying files under HPHPi.
authorepriestley <epriestley@javelinjs.com>
Thu, 24 Feb 2011 22:08:49 +0000 (14:08 -0800)
committerepriestley <epriestley@javelinjs.com>
Thu, 24 Feb 2011 22:08:49 +0000 (14:08 -0800)
Summary:

Test Plan:

Reviewers:

CC:

src/lint/patcher/ArcanistLintPatcher.php

index eefb8ad6937d74c991dbb56ef91529e72f784d3c..de6871473608e47217c15768f44f1c283037049f 100644 (file)
@@ -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);