Changeset View
Changeset View
Standalone View
Standalone View
src/lint/ArcanistLintPatcher.php
Context not available. | |||||
$working_offset = $orig_offset + $this->getCharacterDelta(); | $working_offset = $orig_offset + $this->getCharacterDelta(); | ||||
$old_str = $lint->getOriginalText(); | $old_str = $lint->getOriginalText(); | ||||
$old_len = strlen($old_str); | $old_len = @strlen($old_str); | ||||
$new_str = $lint->getReplacementText(); | $new_str = $lint->getReplacementText(); | ||||
$new_len = strlen($new_str); | $new_len = @strlen($new_str); | ||||
if ($working_offset == strlen($data)) { | if ($working_offset == @strlen($data)) { | ||||
// Temporary hack to work around a destructive hphpi issue, see #451031. | // Temporary hack to work around a destructive hphpi issue, see #451031. | ||||
$data .= $new_str; | $data .= $new_str; | ||||
} else { | } else { | ||||
Context not available. | |||||
private function getCharacterOffset($line_num) { | private function getCharacterOffset($line_num) { | ||||
if ($this->lineOffsets === null) { | if ($this->lineOffsets === null) { | ||||
$lines = explode("\n", $this->getUnmodifiedFileContent()); | $lines = @explode("\n", $this->getUnmodifiedFileContent()); | ||||
$this->lineOffsets = array(0); | $this->lineOffsets = array(0); | ||||
$last = 0; | $last = 0; | ||||
foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
$this->lineOffsets[] = $last + strlen($line) + 1; | $this->lineOffsets[] = $last + @strlen($line) + 1; | ||||
$last += strlen($line) + 1; | $last += @strlen($line) + 1; | ||||
} | } | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0